Skip to content

Instantly share code, notes, and snippets.

@bunlongheng
Last active March 1, 2019 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bunlongheng/b23d775ee7b106cd7cc0ae5ac71b81a9 to your computer and use it in GitHub Desktop.
Save bunlongheng/b23d775ee7b106cd7cc0ae5ac71b81a9 to your computer and use it in GitHub Desktop.
import os
print ("______________\n")
print " 1.GET "
print " 2.POST "
print " 3.PUT "
print " 4.DELETE "
print ("______________\n")
http = int(raw_input("Select your option : "))
url = raw_input("Paste Your URL : ")
if not http:
http = 3
if http == 1:
cmd = 'curl '+ url
elif http == 2:
data = raw_input("Paste Your Data : ")
cmd = 'curl -g -X POST -H "Content-Type:application/json" -d \''+data+'\' ' + url
elif http == 3:
data = raw_input("Paste Your JSON Data: ")
cmd = 'curl -g -X PUT -H "Content-Type:application/json" -d \''+data+'\' ' + url
else:
cmd = 'curl -g -X DELETE ' + url
print ("_________________________________________\n")
print '\n'
print cmd
print '\n'
print ("_________________________________________\n")
run = raw_input("Do you want to run it ? [y/n]: ")
print '\n'
if run == 'y':
os.system(cmd+'\n')
print '\n'
else:
os.system("clear")
sys.exit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment