Skip to content

Commit 3181096

Browse files
committed
output major version release imminent warning
Updates the library to spew out a warning when the client is initialised and when an API call is invoked. This is intentionally annoying and not scoped to stderr to ensure that if anyone does upgrade, they are quickly notified without any impediments.
1 parent 34bcb1b commit 3181096

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

CloudFlare/cloudflare.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,24 @@
2525
DEFAULT_GLOBAL_REQUEST_TIMEOUT = 5
2626
DEFAULT_MAX_REQUEST_RETRIES = 5
2727

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+
2846
class CloudFlare():
2947
""" A Python interface Cloudflare's v4 API.
3048
@@ -50,6 +68,7 @@ class _v4base():
5068

5169
def __init__(self, config):
5270
""" :meta private: """
71+
print(MAJOR_VERSION_WARNING)
5372

5473
self.network = None
5574
self.config = config
@@ -278,6 +297,7 @@ def do_certauth(self, method, parts, identifiers, params=None, data=None, files=
278297

279298
def _call_network(self, method, headers, parts, identifiers, params, data_str, data_json, files):
280299
""" Cloudflare v4 API"""
300+
print(MAJOR_VERSION_WARNING)
281301

282302
if (method is None) or (parts[0] is None):
283303
# should never happen

0 commit comments

Comments
 (0)