Skip to content
This repository was archived by the owner on Nov 22, 2024. It is now read-only.

Commit b5e7356

Browse files
committed
print() was outdate - from pull #120
1 parent 955430c commit b5e7356

2 files changed

Lines changed: 20 additions & 18 deletions

File tree

‎README.md‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def main():
5959
for zone in zones:
6060
zone_id = zone['id']
6161
zone_name = zone['name']
62-
print zone_id, zone_name
62+
print("zone_id=%s zone_name=%s" % (zone_id, zone_name))
6363

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

88-
print zone_id, zone_name, ssl_status, ipv6_status
88+
print("zone_id=%s zone_name=%s" % (zone_id, zone_name))
89+
print("ssl_status=%s ipv6_status=%s" % (ssl_status, ipv6_status))
8990

9091
if __name__ == '__main__':
9192
main()
@@ -110,7 +111,7 @@ def main():
110111
for zone in zones:
111112
zone_id = zone['id']
112113
zone_name = zone['name']
113-
print zone_id, zone_name
114+
print("zone_id=%s zone_name=%s" % (zone_id, zone_name))
114115

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

154155
# print the results - first the zone name
155-
print zone_id, zone_name
156+
print("zone_id=%s zone_name=%s" % (zone_id, zone_name))
156157

157158
# then all the DNS records for that zone
158159
for dns_record in dns_records:
159160
r_name = dns_record['name']
160161
r_type = dns_record['type']
161162
r_value = dns_record['content']
162163
r_id = dns_record['id']
163-
print '\t', r_id, r_name, r_type, r_value
164+
print('\t', r_id, r_name, r_type, r_value)
164165

165166
exit(0)
166167

@@ -322,7 +323,7 @@ import CloudFlare
322323
def main():
323324
cf = CloudFlare.CloudFlare()
324325
zones = cf.zones.get(params={'per_page':5})
325-
print len(zones)
326+
print("len=%d" % (zones.length()))
326327

327328
if __name__ == '__main__':
328329
main()
@@ -345,8 +346,8 @@ import CloudFlare
345346
def main():
346347
cf = CloudFlare.CloudFlare(raw=True)
347348
zones = cf.zones.get(params={'per_page':5})
348-
print zones.length()
349-
print json.dumps(zones, indent=4, sort_keys=True)
349+
print("len=%d" % (zones.length()))
350+
print(json.dumps(zones, indent=4, sort_keys=True))
350351

351352
if __name__ == '__main__':
352353
main()
@@ -908,7 +909,7 @@ def main():
908909
for l in dns_records.splitlines():
909910
if len(l) == 0 or l[0] == ';':
910911
continue
911-
print l
912+
print(l)
912913
exit(0)
913914
914915
if __name__ == '__main__':

‎README.rst‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ A very simple listing of zones within your account; including the IPv6 status of
6464
for zone in zones:
6565
zone_id = zone['id']
6666
zone_name = zone['name']
67-
print zone_id, zone_name
67+
print("zone_id=%s zone_name=%s" % (zone_id, zone_name))
6868
6969
if __name__ == '__main__':
7070
main()
@@ -90,7 +90,8 @@ Now lets expand on that and add code to show the IPv6 and SSL status of the zone
9090
settings_ipv6 = cf.zones.settings.ipv6.get(zone_id)
9191
ipv6_status = settings_ipv6['value']
9292
93-
print zone_id, zone_name, ssl_status, ipv6_status
93+
print("zone_id=%s zone_name=%s" % (zone_id, zone_name))
94+
print("ssl_status=%s ipv6_status=%s" % (ssl_status, ipv6_status))
9495
9596
if __name__ == '__main__':
9697
main()
@@ -114,7 +115,7 @@ Raw mode is only needed when a get request has the possibility of returning many
114115
for zone in zones:
115116
zone_id = zone['id']
116117
zone_name = zone['name']
117-
print zone_id, zone_name
118+
print("zone_id=%s zone_name=%s" % (zone_id, zone_name))
118119
119120
total_pages = raw_results['result_info']['total_pages']
120121
if page_number == total_pages:
@@ -156,15 +157,15 @@ A more complex example follows.
156157
exit('/zones/dns_records.get %d %s - api call failed' % (e, e))
157158
158159
# print the results - first the zone name
159-
print zone_id, zone_name
160+
print("zone_id=%s zone_name=%s" % (zone_id, zone_name))
160161
161162
# then all the DNS records for that zone
162163
for dns_record in dns_records:
163164
r_name = dns_record['name']
164165
r_type = dns_record['type']
165166
r_value = dns_record['content']
166167
r_id = dns_record['id']
167-
print '\t', r_id, r_name, r_type, r_value
168+
print('\t', r_id, r_name, r_type, r_value)
168169
169170
exit(0)
170171
@@ -326,7 +327,7 @@ You can return all the paging values by calling the class with raw=True. Here’
326327
def main():
327328
cf = CloudFlare.CloudFlare()
328329
zones = cf.zones.get(params={'per_page':5})
329-
print len(zones)
330+
print("len=%d" % (zones.length()))
330331
331332
if __name__ == '__main__':
332333
main()
@@ -349,8 +350,8 @@ When you add the raw option; the APIs full structure is returned. This means the
349350
def main():
350351
cf = CloudFlare.CloudFlare(raw=True)
351352
zones = cf.zones.get(params={'per_page':5})
352-
print zones.length()
353-
print json.dumps(zones, indent=4, sort_keys=True)
353+
print("len=%d" % (zones.length()))
354+
print(json.dumps(zones, indent=4, sort_keys=True))
354355
355356
if __name__ == '__main__':
356357
main()
@@ -923,7 +924,7 @@ This can also be done via Python code with the following example.
923924
for l in dns_records.splitlines():
924925
if len(l) == 0 or l[0] == ';':
925926
continue
926-
print l
927+
print(l)
927928
exit(0)
928929

929930
if __name__ == '__main__':

0 commit comments

Comments
 (0)