-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Replace urllib with requests in openlibrary.core.fulltext #4410
Replace urllib with requests in openlibrary.core.fulltext #4410
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.
Nice!
The other approach here would be to put the happy path in a single
|
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.
json.decoder.JSONDecodeError
will not be defined in Py2.
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Thanks, I applied those suggestions. |
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.
LGTM
…chive#4410) * Replace urllib with requests in openlibrary.core.fulltext * Applied isort and black on fulltext and test_fulltext * Simplify code by re-arraging try/except * Update openlibrary/tests/core/test_fulltext.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update openlibrary/tests/core/test_fulltext.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update openlibrary/core/fulltext.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update openlibrary/core/fulltext.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update fulltext.py Co-authored-by: Christian Clauss <cclauss@me.com>
…chive#4410) * Replace urllib with requests in openlibrary.core.fulltext * Applied isort and black on fulltext and test_fulltext * Simplify code by re-arraging try/except * Update openlibrary/tests/core/test_fulltext.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update openlibrary/tests/core/test_fulltext.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update openlibrary/core/fulltext.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update openlibrary/core/fulltext.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update fulltext.py Co-authored-by: Christian Clauss <cclauss@me.com>
…chive#4410) * Replace urllib with requests in openlibrary.core.fulltext * Applied isort and black on fulltext and test_fulltext * Simplify code by re-arraging try/except * Update openlibrary/tests/core/test_fulltext.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update openlibrary/tests/core/test_fulltext.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update openlibrary/core/fulltext.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update openlibrary/core/fulltext.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update fulltext.py Co-authored-by: Christian Clauss <cclauss@me.com>
…chive#4410) * Replace urllib with requests in openlibrary.core.fulltext * Applied isort and black on fulltext and test_fulltext * Simplify code by re-arraging try/except * Update openlibrary/tests/core/test_fulltext.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update openlibrary/tests/core/test_fulltext.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update openlibrary/core/fulltext.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update openlibrary/core/fulltext.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update fulltext.py Co-authored-by: Christian Clauss <cclauss@me.com>
…chive#4410) * Replace urllib with requests in openlibrary.core.fulltext * Applied isort and black on fulltext and test_fulltext * Simplify code by re-arraging try/except * Update openlibrary/tests/core/test_fulltext.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update openlibrary/tests/core/test_fulltext.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update openlibrary/core/fulltext.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update openlibrary/core/fulltext.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update fulltext.py Co-authored-by: Christian Clauss <cclauss@me.com>
…chive#4410) * Replace urllib with requests in openlibrary.core.fulltext * Applied isort and black on fulltext and test_fulltext * Simplify code by re-arraging try/except * Update openlibrary/tests/core/test_fulltext.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update openlibrary/tests/core/test_fulltext.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update openlibrary/core/fulltext.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update openlibrary/core/fulltext.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update fulltext.py Co-authored-by: Christian Clauss <cclauss@me.com>
Addresses #2852
Refactor
openlibrary.core.fulltext
to replace urllib.openurl with requests.get. Adds unittests for the exception cases.Technical
The fulltext search api function is used in a couple of places;
plugins/inside/code.py
plugins/worksearch/code.py
Testing
Unit tests were added for exception cases. You should also be able to do searches on staging in both "/search" and worksearch.
Screenshot
N/A
Stakeholders
@cclauss