Add web program to fetch top 10 real time billionaires using the forbes API.#7538
Conversation
There was a problem hiding this comment.
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 reviewto trigger the checks for only added pull request files@algorithms-keeper review-allto 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.
| "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.
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.
Thank you. This has been modified here: c85adac
| Returns: | ||
| Top 10 realtime billionaires date in tabulated string. |
There was a problem hiding this comment.
| 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.
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.
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 |
| 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.
| 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) |
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
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.
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}.