-
-
Notifications
You must be signed in to change notification settings - Fork 46.8k
Add web program to fetch top 10 real time billionaires using the forbes API. #7538
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
Add web program to fetch top 10 real time billionaires using the forbes API. #7538
Conversation
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.
Click here to look at the relevant links ⬇️
🔗 Relevant Links
Repository:
Python:
Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.
algorithms-keeper
commands and options
algorithms-keeper actions can be triggered by commenting on this PR:
@algorithms-keeper review
to trigger the checks for only added pull request files@algorithms-keeper review-all
to trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.
I like this one. Instead of Tabulate, would you be willing to do the table in Rich instead?
|
"Age": today.year | ||
- birthdate.year | ||
- ((today.month, today.day) < (birthdate.month, birthdate.day)), |
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.
"Age": today.year | |
- birthdate.year | |
- ((today.month, today.day) < (birthdate.month, birthdate.day)), | |
"Age": ( | |
today.year - birthdate.year - | |
((today.month, today.day) < (birthdate.month, birthdate.day)) | |
), |
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.
I believe that psf/black will reformat this back to the original solution (terms on separate lines).
For rich
, we may need to convert age to a str.
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.
Thank you. This has been modified here: c85adac
Returns: | ||
Top 10 realtime billionaires date in tabulated string. |
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.
Returns: | |
Top 10 realtime billionaires date in tabulated string. | |
Returns the Top 10 realtime billionaires date in tabulated string. |
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.
This is a comment syntax that some editors (PyCharm, I think) prefer so we should leave it as is.
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.
Yeah, this was automatically done by PyCharm. However, I've modified it a bit. c85adac
Thank you, @cclauss for reviewing it. Rich is awesome. I've modified it here: c85adac |
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.
Small change
from rich import box | ||
from rich import console as rich_console | ||
from rich import table as rich_table |
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.
from rich import box | |
from rich import console as rich_console | |
from rich import table as rich_table | |
from rich import (box, console as rich_console, table as rich_table) |
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.
isort sorts your imports so you don't have to. ;-)
Co-authored-by: Caeden Perelli-Harris <[email protected]>
for more information, see https://pre-commit.ci
Oh, apparently the |
It does not work on my Mac. I get But if I go to the URL with my browser, it looks like all the right stuff. |
Does it work on your machine @CaedenPH ? |
I also get the |
Often we can solve these issues with |
Oh!! That's weird. It's working as expected on my mac. |
Do you have a Forbes login that you are using? |
I can hit the api successfully when I visit the url manually, but |
@dhruvmanila Any ideas on how to make this work? Should we use |
API_URL = ( | ||
"https://www.forbes.com/forbesapi/person/rtb/0/position/true.json" | ||
"?fields=personName,gender,source,countryOfCitizenship,birthDate,finalWorth" | ||
f"&limit={LIMIT}" | ||
) |
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.
requests
can automatically encode the URL parameters: https://requests.readthedocs.io/en/latest/user/quickstart/#passing-parameters-in-urls. Please use this instead.
Oh, already merged. Also, checks are failing. |
Describe your change:
Using the Forbes API to get the top ten real-time billionaires and present in a rich table.
Here's the sample output:

Checklist:
Fixes: #{$ISSUE_NO}
.