-
-
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
2879 requests cleanup #2894
2879 requests cleanup #2894
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.
This looks good to me.
@mekarpeles , could you take a quick look at the sponsorship code changes and make sure you are happy with them? I know you are working on this area at the moment.
If this doesn't conflict with any current in-flight work, I am happy to merge this ASAP.
The switch to Requests was only partially done without any error handling. This switches the error handling to use Requests too.
For the remaining one that's needed import using six so that it's compatible with both Python 2 and 3.
66f0969
to
804739c
Compare
Rebased to address merge conflict. Please force refresh any checked out branches. |
@cdrini I have put this of dev.openlibrary.org for testing |
@@ -50,7 +49,7 @@ def get_sponsorships_by_contact_id(contact_id, isbn=None): | |||
data['json'] = json.dumps(data['json']) # flatten the json field as a string | |||
r = requests.get( | |||
lending.config_ia_civicrm_api.get('url', ''), | |||
params=urllib.urlencode(data), | |||
params=data, |
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'm concerned about removing the urllib.urleencode
here, I feel like titles w/ encodings and other cases necessitated this addition and I get the feeling this is going to break things.
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.
The Python Docs recommend the use of the Requests module over the Standard Library because it has a much cleaner API and because in handles Unicode issues so much better. On both Python 2 and Python 3 Requests favours Unicode over bytes/str and its convince functions just work without the struggles that the Standard Library imposes.
Closes #2879
Removes unnecessary
urlencode()
calls and fixes up the import for the remaining one that's needed.Stakeholders
@cdrini for
vendors.py
@tabshaikh for the others - as mentioned in the issue, I think this is your code, so please review.@mekarpeles