Created
April 1, 2016 01:56
-
-
Save anton-dzodzikov/eccb97b7cd8ea3cac488394bc9294381 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def send_request(url, data, method, content_type): | |
| """ | |
| Send HTTP request and return response | |
| """ | |
| opener = urllib2.build_opener(urllib2.HTTPHandler) | |
| request = urllib2.Request(url, data=data) | |
| request.add_header('Content-Type', content_type) | |
| request.get_method = lambda: method | |
| return opener.open(request).read() |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Allows to use PUT and other methods