Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion 05_github.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,25 @@
if __name__ == "__main__":
url_1 = "https://api.github.com/emaadmanzoor"
r = requests.get(url_1)
print(r.status_code)
print('The error code appears to be: ' + str(r.status_code))
print('\n')
print(r.json())
print('\n')
print("Let's try again...")

for x in range(0,6):
print('Attempt #'+ str(x))
status = r.status_code
if status != 200:
print('The error code is still ' + str(status) + '.')
seconds = 2
print("Let's wait", seconds, "seconds and try again")
time.sleep(seconds)
else:
print('Wait it actually worked!')
break
print('Looks like we still get an error code of', str(status))


url_2 = "https://api.github.com/users/emaadmanzoor"
r = requests.get(url_2)
Expand All @@ -34,3 +51,14 @@

print("Sleeping until reset...")
time.sleep(remaining_time)


#Challenge Lab 1
#Determine error code
#If request fails, pause code using time.sleep and retry
#Determine the amount of retries
#Code should fail, but output is an error message


#Challenge Lab 2
#Use boto3 python library to create buckets in S3 and push any data through