-
Notifications
You must be signed in to change notification settings - Fork 381
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
#155 Implement get_stock_earnings function. #249
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #249 +/- ##
==========================================
- Coverage 91.00% 90.93% -0.08%
==========================================
Files 26 26
Lines 4949 4988 +39
==========================================
+ Hits 4504 4536 +32
- Misses 445 452 +7 |
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.
Everything seems fine besides the minor changes that I asked you to check, once you check those and the merge conflicts are solved I'll merge this as some users are requesting this feature and/or using your fork (which is no longer up to date as this PR is from Dec 2020).
Thanks for your work! 👍🏻
investpy/stocks.py
Outdated
"User-Agent": random_user_agent(), | ||
"X-Requested-With": "XMLHttpRequest", | ||
"Accept": "text/html", | ||
"Accept-Encoding": "gzip, deflate, br", |
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.
br
no longer accepted, you should update this line with "Accept-Encoding": "gzip, deflate"
as reported in #328
|
||
objs = list() | ||
|
||
if path_: |
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.
Missing else
statement, should raise an Exception just like all the other stock functions, please check https://github.com/alvarobartt/investpy/blob/master/investpy/stocks.py to see the latest changes and apply them here!
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 think the else statement and Exception are already implemented as same as the following function.
Line 803 in 16b14f0
def get_stock_dividends(stock, country): |
investpy/stocks.py
Outdated
|
||
def get_stock_earnings(stock, country): | ||
""" | ||
This function retrieves the earnings data from the specified stock. Earnings data include date of the |
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.
Minor/Silly fix, but can you un-tab this so as to align it with all the docstrings? Thanks!
@@ -1506,3 +1506,176 @@ def search_stocks(by, value): | |||
search_result.reset_index(drop=True, inplace=True) | |||
|
|||
return search_result | |||
|
|||
|
|||
def get_stock_earnings(stock, country): |
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.
As there are some changes in the stocks.py
file in the master branch, could you pull the current file from the master and add your function at the end so that the PR has no merge conflicts?
Also, can you please check whether this functionality is the same as implemented in #242? |
Hi @t-tani , do you plan to create a new patch due to the new html format at investing.com and investpy? Thanks and regards, |
@alvarobartt Thank you for the code review. I will fix the code you pointed. In #242, you could get the latest earnings data from all stocks; however, you could not specify the stock name. With this code, you could get the earnings from the specified stock. @markus080402 |
@alvarobartt |
Hi @alvarobartt,
Thank you for creating an awesome scraping library.
I created the get_stock_eranings function for my own use.
I hope this pull request helps your development.