diff --git a/README.md b/README.md index 48f1c23..eab8eff 100644 --- a/README.md +++ b/README.md @@ -338,6 +338,19 @@ $ While it's easy to call anything within CloudFlare's API, it's not very useful to add items in here as they will simply return API URL errors. Technically, this is only useful for internal testing within CloudFlare. +## Issues + +The following error can be caused by an out of date SSL/TLS library and/or out of date Python. + +``` +/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning. + SNIMissingWarning +/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. + InsecurePlatformWarning +``` + +The solution can be found [here](https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning) and/or [here](http://stackoverflow.com/questions/35144550/how-to-install-cryptography-on-ubuntu). + ## Credit This is based on work by [Felix Wong (gnowxilef)](https://github.com/gnowxilef) found [here](https://github.com/cloudflare-api/python-cloudflare-v4). It has been seriously expanded upon. diff --git a/README.rst b/README.rst index ebab34c..47130b7 100644 --- a/README.rst +++ b/README.rst @@ -444,6 +444,24 @@ While it's easy to call anything within CloudFlare's API, it's not very useful to add items in here as they will simply return API URL errors. Technically, this is only useful for internal testing within CloudFlare. +Issues +------ + +The following error can be caused by an out of date SSL/TLS library +and/or out of date Python. + +:: + + /usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning. + SNIMissingWarning + /usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. + InsecurePlatformWarning + +The solution can be found +`here `__ +and/or +`here `__. + Credit ------ diff --git a/cli4/cli4.py b/cli4/cli4.py index 1ac0a1e..dfe1b9e 100644 --- a/cli4/cli4.py +++ b/cli4/cli4.py @@ -6,9 +6,12 @@ import CloudFlare import re -import json -import yaml import getopt +import json +try: + import yaml +except ImportError: + yaml = None def convert_zones_to_identifier(cf, zone_name): params = {'name':zone_name,'per_page':1} @@ -137,9 +140,10 @@ def cli4(args): elif (value[0] is '{' and value[-1] is '}') or (value[0] is '[' and value[-1] is ']'): # a json structure - used in pagerules try: - #value = json.loads(value) - changed to yaml code to remove unicode strings + #value = json.loads(value) - changed to yaml code to remove unicode string issues + if yaml is None: + exit('cli4: install yaml support') value = yaml.safe_load(value) - # success except ValueError: exit('cli4: %s="%s" - can\'t parse json value' % (tag, value)) params[tag] = value @@ -226,6 +230,6 @@ def cli4(args): if output == 'json': print json.dumps(r, indent=4, sort_keys=True) - if output == 'yaml': + if output == 'yaml' and yaml is not None: print yaml.dump(r) diff --git a/setup.py b/setup.py index ec9dd58..4f9a331 100755 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setup( name='cloudflare', - version='1.0.3', + version='1.0.4', description='Python wrapper for the CloudFlare v4 API', long_description=long_description, author='Martin J. Levy', @@ -18,7 +18,7 @@ url='https://github.com/cloudflare/python-cloudflare', license='MIT', packages=['cli4']+find_packages(), - install_requires=['requests'], + install_requires=['requests', 'future', 'pyyaml'], keywords='cloudflare', entry_points={ 'console_scripts': [ @@ -33,6 +33,9 @@ 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', + # 'Programming Language :: Python :: 3', + # 'Programming Language :: Python :: 3.4', + # 'Programming Language :: Python :: 3.5', ] )