1818from .api_extras import api_extras
1919from .api_decode_from_openapi import api_decode_from_openapi
2020from .exceptions import CloudFlareAPIError , CloudFlareInternalError
21+ from .warning_2_20 import warning_2_20 , print_warning_2_20
2122
2223BASE_URL = 'https://api.cloudflare.com/client/v4'
2324OPENAPI_URL = 'https://github.com/cloudflare/api-schemas/raw/main/openapi.json'
2425
2526DEFAULT_GLOBAL_REQUEST_TIMEOUT = 5
2627DEFAULT_MAX_REQUEST_RETRIES = 5
2728
28- MAJOR_VERSION_WARNING = """
29- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
30- !! !!
31- !! You are seeing this warning because you have upgraded to a version that is !!
32- !! not intended to be installed. !!
33- !! !!
34- !! This version only exists to catch any accidental upgrades before we !!
35- !! release a major release. !!
36- !! !!
37- !! You should determine if you need to revert this upgrade and pin to v2.19.* !!
38- !! or if you can upgrade to v3.x. !!
39- !! !!
40- !! To see more about upgrading to next major version, please see !!
41- !! https://github.com/cloudflare/python-cloudflare/discussions/191 !!
42- !! !!
43- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
44- """
45-
4629class CloudFlare ():
4730 """ A Python interface Cloudflare's v4 API.
4831
@@ -68,7 +51,6 @@ class _v4base():
6851
6952 def __init__ (self , config ):
7053 """ :meta private: """
71- print (MAJOR_VERSION_WARNING )
7254
7355 self .network = None
7456 self .config = config
@@ -107,6 +89,13 @@ def __init__(self, config):
10789
10890 self .logger = CFlogger (config ['debug' ]).getLogger () if 'debug' in config and config ['debug' ] else None
10991
92+ warning = warning_2_20 ()
93+ if warning :
94+ if self .logger :
95+ self .logger .warning ('\n ' + warning )
96+ else :
97+ print_warning_2_20 (warning )
98+
11099 def __del__ (self ):
111100 if self .network :
112101 del self .network
@@ -297,7 +286,6 @@ def do_certauth(self, method, parts, identifiers, params=None, data=None, files=
297286
298287 def _call_network (self , method , headers , parts , identifiers , params , data_str , data_json , files ):
299288 """ Cloudflare v4 API"""
300- print (MAJOR_VERSION_WARNING )
301289
302290 if (method is None ) or (parts [0 ] is None ):
303291 # should never happen
0 commit comments