Skip to content

Commit 6eb3069

Browse files
Add support for env variable JUDGE0_SUPPRESS_PREVIEW_WARNING. (#19)
* Add support for env variable JUDGE0_SUPPRESS_PREVIEW_WARNING. * Minor change to preview warning suppression logic --------- Co-authored-by: Filip Karlo Došilović <filipk.dosilovic@gmail.com>
1 parent 1b1f8b1 commit 6eb3069

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/judge0/__init__.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565

6666
JUDGE0_IMPLICIT_CE_CLIENT = None
6767
JUDGE0_IMPLICIT_EXTRA_CE_CLIENT = None
68+
SUPPRESS_PREVIEW_WARNING = os.getenv("JUDGE0_SUPPRESS_PREVIEW_WARNING")
6869

6970
logger = logging.getLogger(__name__)
7071

@@ -106,11 +107,12 @@ def _get_implicit_client(flavor: Flavor) -> Client:
106107

107108

108109
def _get_preview_client(flavor: Flavor) -> Union[Judge0CloudCE, Judge0CloudExtraCE]:
109-
logger.warning(
110-
"You are using a preview version of the client which is not recommended"
111-
" for production.\n"
112-
"For production, please specify your API key in the environment variable."
113-
)
110+
if SUPPRESS_PREVIEW_WARNING is not None:
111+
logger.warning(
112+
"You are using a preview version of the client which is not recommended"
113+
" for production.\n"
114+
"For production, please specify your API key in the environment variable."
115+
)
114116

115117
if flavor == Flavor.CE:
116118
return Judge0CloudCE()

0 commit comments

Comments
 (0)