Skip to content

Commit de93350

Browse files
Add warning when using preview client
1 parent 802ce9e commit de93350

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/judge0/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import logging
12
import os
23

34
from typing import Union
@@ -65,6 +66,8 @@
6566
JUDGE0_IMPLICIT_CE_CLIENT = None
6667
JUDGE0_IMPLICIT_EXTRA_CE_CLIENT = None
6768

69+
logger = logging.getLogger(__name__)
70+
6871

6972
def _get_implicit_client(flavor: Flavor) -> Client:
7073
global JUDGE0_IMPLICIT_CE_CLIENT, JUDGE0_IMPLICIT_EXTRA_CE_CLIENT
@@ -104,6 +107,12 @@ def _get_implicit_client(flavor: Flavor) -> Client:
104107

105108

106109
def _get_preview_client(flavor: Flavor) -> Union[SuluJudge0CE, SuluJudge0ExtraCE]:
110+
logger.warning(
111+
"You are using a preview version of the client which is not recommended"
112+
" for production.\n"
113+
"For production, please specify your API key in the environment variable."
114+
)
115+
107116
if flavor == Flavor.CE:
108117
return SuluJudge0CE(retry_strategy=RegularPeriodRetry(0.5))
109118
else:

0 commit comments

Comments
 (0)