It is my understanding that, I need to use url encoded content for posting with urllib. Is it possible to use application/json content type when posting with urllib?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Not with urllib, as you’d need to set the
Content-typeheader, and urllib does not provide a way to do so. You can do it however with urllib2 (but also not withurlopen()wich is more meant to “open files with a url” rather than submitting data):Personally, I prefer httplib2 (3d party) as a http client library.