11#!/usr/bin/env python
22"""Cloudflare API code - example"""
33
4+ from __future__ import print_function
5+
46import os
57import sys
68
@@ -15,15 +17,15 @@ def main():
1517 try :
1618 if sys .argv [1 ] == '--off' :
1719 update_flag = True
18- new_value = 'off'
20+ new_value = 'off'
1921 sys .argv .pop (1 )
2022 except IndexError :
2123 pass
2224
2325 try :
2426 if sys .argv [1 ] == '--on' :
2527 update_flag = True
26- new_value = 'on'
28+ new_value = 'on'
2729 sys .argv .pop (1 )
2830 except IndexError :
2931 pass
@@ -55,17 +57,17 @@ def main():
5557
5658 present_value = r ['value' ]
5759
58- print zone_id , zone_name , present_value
60+ print ( zone_id , zone_name , present_value )
5961
6062 if update_flag and present_value != new_value :
61- print '\t ' , '(now updating... %s -> %s)' % (present_value , new_value )
63+ print ( '\t ' , '(now updating... %s -> %s)' % (present_value , new_value ) )
6264 try :
6365 r = cf .zones .settings .always_use_https .patch (zone_id , data = {'value' :new_value })
6466 except CloudFlare .exceptions .CloudFlareAPIError as e :
6567 exit ('/zones.settings.always_use_https.patch %d %s - api call failed' % (e , e ))
6668 updated_value = r ['value' ]
6769 if new_value == updated_value :
68- print '\t ' , '... updated!'
70+ print ( '\t ' , '... updated!' )
6971
7072if __name__ == '__main__' :
7173 main ()
0 commit comments