Skip to content
Open
Show file tree
Hide file tree
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
19 changes: 11 additions & 8 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@
if __name__ == "__main__":
username = sys.argv[1]

# TODO:
#
# 1. Retrieve a list of "events" associated with the given user name
# 2. Print out the time stamp associated with the first event in that list.

print("COMPLETE THE TODOs")


#1. Retrieve a list of "events" associated with the given user name
events = requests.get('https://api.github.com/users/{}/events'.format(username))

# 2. if the status_code is 200 and the returned events list is not empty, then
# print out the time stamp associated with the first event in that list
if events.status_code:
if events.json():
print(f"User:{username} create first event at: {events.json()[0]['created_at']}")
else:
print(f"The events list for user:\"{username}\" is empty.")
else:
print(f"Couldn't find the user:\"{username}\"")
20 changes: 20 additions & 0 deletions old.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import sys
import json

import requests

# Use Like python githubber.py JASchilz
# (or another user name)

if __name__ == "__main__":
username = sys.argv[1]

# TODO:
#
# 1. Retrieve a list of "events" associated with the given user name
# 2. Print out the time stamp associated with the first event in that list.

print("COMPLETE THE TODOs")