Created
June 24, 2016 03:32
-
-
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.
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
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