-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added phone field in print_user function #1
base: main
Are you sure you want to change the base?
Conversation
8db959c
to
a820593
Compare
with open(filename, "w") as file: | ||
json.dump(user_data, file, indent=4) | ||
|
||
|
||
def read_user_from_file(filename): | ||
def read_user_from_file(filename: str) -> dict: | ||
with open(filename, "r") as file: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add exception handling for case of non-existing file
name = user["results"][0]["name"] | ||
print(f"Name: {name['title']} {name['first']} {name['last']}") | ||
email = user["results"][0]["email"] | ||
print(f"Email: {email}") | ||
phone = user["results"][0]["phone"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid directly getting elements and fields from dictionary. Make it safe here and everywhere in this function. Refactor this function.
@@ -2,26 +2,28 @@ | |||
import requests | |||
|
|||
|
|||
def fetch_random_user(): | |||
def fetch_random_user() -> dict: | |||
response = requests.get("https://randomuser.me/api/") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
measure and print how much time get request took
@@ -1,2 +1,2 @@ | |||
# demo_repo_for_gptmypr | |||
Sample project to practice using gptmypr tool | |||
Sample project to practice using gptmypr tool (https://github.com/waclawthedev/GPTmyPR) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tell more about GPT (2 sentences)
No description provided.