Skip to content

Instantly share code, notes, and snippets.

@the-c0d3r
Created June 24, 2016 03:32
Show Gist options
  • Save the-c0d3r/733f82a9b1efbf2c2a3964b484f30530 to your computer and use it in GitHub Desktop.
Save the-c0d3r/733f82a9b1efbf2c2a3964b484f30530 to your computer and use it in GitHub Desktop.
A small tool to send POST request with data, and shows the response.
import requests
def post(url=None, payload=None):
if not url:
url = getinput("Enter POST url : ")
if not payload:
payload = getinput("Enter POST data : ")
r = requests.post(url, data=payload)
response = r.text
print "\n-------------------------"
print response
print "-------------------------"
def getinput(ques):
tmp = raw_input(ques)
while len(tmp) <= 1:
tmp = raw_input(ques)
return tmp
if __name__ == "__main__":
import sys
usage = "post [url] [data]"
if len(sys.argv) < 1:
post()
elif len(sys.argv) == 2:
post(sys.argv[1], sys.argv[2])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment