Skip to content

Commit

Permalink
print() was outdate - from pull #120
Browse files Browse the repository at this point in the history
  • Loading branch information
mahtin committed Mar 30, 2022
1 parent 955430c commit b5e7356
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def main():
for zone in zones:
zone_id = zone['id']
zone_name = zone['name']
print zone_id, zone_name
print("zone_id=%s zone_name=%s" % (zone_id, zone_name))

if __name__ == '__main__':
main()
Expand All @@ -85,7 +85,8 @@ def main():
settings_ipv6 = cf.zones.settings.ipv6.get(zone_id)
ipv6_status = settings_ipv6['value']

print zone_id, zone_name, ssl_status, ipv6_status
print("zone_id=%s zone_name=%s" % (zone_id, zone_name))
print("ssl_status=%s ipv6_status=%s" % (ssl_status, ipv6_status))

if __name__ == '__main__':
main()
Expand All @@ -110,7 +111,7 @@ def main():
for zone in zones:
zone_id = zone['id']
zone_name = zone['name']
print zone_id, zone_name
print("zone_id=%s zone_name=%s" % (zone_id, zone_name))

total_pages = raw_results['result_info']['total_pages']
if page_number == total_pages:
Expand Down Expand Up @@ -152,15 +153,15 @@ def main():
exit('/zones/dns_records.get %d %s - api call failed' % (e, e))

# print the results - first the zone name
print zone_id, zone_name
print("zone_id=%s zone_name=%s" % (zone_id, zone_name))

# then all the DNS records for that zone
for dns_record in dns_records:
r_name = dns_record['name']
r_type = dns_record['type']
r_value = dns_record['content']
r_id = dns_record['id']
print '\t', r_id, r_name, r_type, r_value
print('\t', r_id, r_name, r_type, r_value)

exit(0)

Expand Down Expand Up @@ -322,7 +323,7 @@ import CloudFlare
def main():
cf = CloudFlare.CloudFlare()
zones = cf.zones.get(params={'per_page':5})
print len(zones)
print("len=%d" % (zones.length()))

if __name__ == '__main__':
main()
Expand All @@ -345,8 +346,8 @@ import CloudFlare
def main():
cf = CloudFlare.CloudFlare(raw=True)
zones = cf.zones.get(params={'per_page':5})
print zones.length()
print json.dumps(zones, indent=4, sort_keys=True)
print("len=%d" % (zones.length()))
print(json.dumps(zones, indent=4, sort_keys=True))

if __name__ == '__main__':
main()
Expand Down Expand Up @@ -908,7 +909,7 @@ def main():
for l in dns_records.splitlines():
if len(l) == 0 or l[0] == ';':
continue
print l
print(l)
exit(0)
if __name__ == '__main__':
Expand Down
19 changes: 10 additions & 9 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ A very simple listing of zones within your account; including the IPv6 status of
for zone in zones:
zone_id = zone['id']
zone_name = zone['name']
print zone_id, zone_name
print("zone_id=%s zone_name=%s" % (zone_id, zone_name))
if __name__ == '__main__':
main()
Expand All @@ -90,7 +90,8 @@ Now lets expand on that and add code to show the IPv6 and SSL status of the zone
settings_ipv6 = cf.zones.settings.ipv6.get(zone_id)
ipv6_status = settings_ipv6['value']
print zone_id, zone_name, ssl_status, ipv6_status
print("zone_id=%s zone_name=%s" % (zone_id, zone_name))
print("ssl_status=%s ipv6_status=%s" % (ssl_status, ipv6_status))
if __name__ == '__main__':
main()
Expand All @@ -114,7 +115,7 @@ Raw mode is only needed when a get request has the possibility of returning many
for zone in zones:
zone_id = zone['id']
zone_name = zone['name']
print zone_id, zone_name
print("zone_id=%s zone_name=%s" % (zone_id, zone_name))
total_pages = raw_results['result_info']['total_pages']
if page_number == total_pages:
Expand Down Expand Up @@ -156,15 +157,15 @@ A more complex example follows.
exit('/zones/dns_records.get %d %s - api call failed' % (e, e))
# print the results - first the zone name
print zone_id, zone_name
print("zone_id=%s zone_name=%s" % (zone_id, zone_name))
# then all the DNS records for that zone
for dns_record in dns_records:
r_name = dns_record['name']
r_type = dns_record['type']
r_value = dns_record['content']
r_id = dns_record['id']
print '\t', r_id, r_name, r_type, r_value
print('\t', r_id, r_name, r_type, r_value)
exit(0)
Expand Down Expand Up @@ -326,7 +327,7 @@ You can return all the paging values by calling the class with raw=True. Here’
def main():
cf = CloudFlare.CloudFlare()
zones = cf.zones.get(params={'per_page':5})
print len(zones)
print("len=%d" % (zones.length()))
if __name__ == '__main__':
main()
Expand All @@ -349,8 +350,8 @@ When you add the raw option; the APIs full structure is returned. This means the
def main():
cf = CloudFlare.CloudFlare(raw=True)
zones = cf.zones.get(params={'per_page':5})
print zones.length()
print json.dumps(zones, indent=4, sort_keys=True)
print("len=%d" % (zones.length()))
print(json.dumps(zones, indent=4, sort_keys=True))
if __name__ == '__main__':
main()
Expand Down Expand Up @@ -923,7 +924,7 @@ This can also be done via Python code with the following example.
for l in dns_records.splitlines():
if len(l) == 0 or l[0] == ';':
continue
print l
print(l)
exit(0)

if __name__ == '__main__':
Expand Down

0 comments on commit b5e7356

Please sign in to comment.