Skip to content

Commit

Permalink
handle exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
mahtin committed Sep 7, 2022
1 parent a28a13e commit 1f433ac
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions examples/example_time_calls.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,26 @@ def main():

print('Create')
tic = time.process_time_ns()
cf = CloudFlare.CloudFlare()
try:
cf = CloudFlare.CloudFlare()
except Exception as e:
print('\tError: %s' % (e))
cf = None
toc = time.process_time_ns()
print('\t%7.3f ms' % ((toc-tic)/1000000.0))
print('')

if not cf:
return

print('Call')
for ii in range(0,10):
tic = time.process_time_ns()
r = cf.ips()
try:
r = cf.ips()
except Exception as e:
print('\tError: %s' % (e))
break
toc = time.process_time_ns()
print('\t%7.3f ms' % ((toc-tic)/1000000.0))
print('')
Expand Down

0 comments on commit 1f433ac

Please sign in to comment.