Last active
December 30, 2017 11:48
-
-
Save vladwa/78c280501a3d3d232ec9697bf436d643 to your computer and use it in GitHub Desktop.
Python code to make HTTP post request. This function returns Response object.
This file contains 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
# importing the requests library | |
import requests | |
def getPostRestResponse(restUrl,inputRequest,contentType): | |
"""Sends a POST request. | |
:param url: URL for the new :class:`Request` object. | |
:param inputRequest: Data to send in the body of the request. | |
:return: :class:`Response <Response>` object. | |
""" | |
content = {'content-type': contentType} | |
response = requests.post(restUrl, inputRequest, headers=content) | |
return response |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment