Skip to content

Instantly share code, notes, and snippets.

@terrafied
Last active September 6, 2019 22:29
Show Gist options
  • Save terrafied/9bb4c2b01b7cf02359031deb28469dad to your computer and use it in GitHub Desktop.
Save terrafied/9bb4c2b01b7cf02359031deb28469dad to your computer and use it in GitHub Desktop.
import json
import urllib2
data = {}
req = urllib2.Request("http://10.10.10.161:5000/apitest")
req.add_header('Content-Type', 'application/json')
response = urllib2.urlopen(req, json.dumps(data))
if response.get_code() != 200:
raise Exception("Response code: {0}".format(response.get_code())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment