-
Notifications
You must be signed in to change notification settings - Fork 97
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
Suggested upgrade to the SerpApiClient.get_html() method #69
Conversation
@gutoarraes Sorry about that! You should be able to grad directly the HTML from just the ID. No need to download the JSON first. The URL should be always structured like this: https://serpapi.com/searches/5b50d58a304bda2fca30bac9.json?api_key=f0776d63edb8dd607154f126eb2c07049ef4bc06caf6f621d5065be2458a607d. Do you want to update your PR in this way or should we do it? Thank you! |
Hey @hartator, thanks for clarifying! If you wouldn't mind I'd like to give it a crack. |
Cool, thank you! Meant https://serpapi.com/searches/5b50d58a304bda2fca30bac9.html?api_key=f0776d63edb8dd607154f126eb2c07049ef4bc06caf6f621d5065be2458a607d instead of https://serpapi.com/searches/5b50d58a304bda2fca30bac9.json?api_key=f0776d63edb8dd607154f126eb2c07049ef4bc06caf6f621d5065be2458a607d in my earlier comment of course. |
I was cracking my head a bit about this just to realize I had already changed the PR but didn't update the description here. I removed the accessing of the JSON and simply appendended Let me know if there is a better approach, but I believe this may be what you're talking about. |
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.
@gutoarraes Thank you for your help!
Let's fix the test for get_html
.
643c415
to
6816b81
Compare
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 @ilyazub for the suggestions. I've applied everything and it's now ready for review.
Will start looking for the my next contribution. Cheers!
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.
Works and looks good. Thank you, @gutoarraes.
My suggestion to fix the open issue 66.
Since the returned object from
requests.get
isn't necessarily an HTML, I approached this by accessing the JSON returned fromget_dictionary
and performing anotherrequests.get
on theraw_html_file
.Also added an assertion in
test_google_search.py
to confirm there is a<html>
tag present in the returned data.