Skip to content

Instantly share code, notes, and snippets.

@aroyrev
Forked from thepacketgeek/python-post-json.py
Created June 10, 2019 22:24
Show Gist options
  • Save aroyrev/358ba3fc18962950fadedee4a4e0efa5 to your computer and use it in GitHub Desktop.
Save aroyrev/358ba3fc18962950fadedee4a4e0efa5 to your computer and use it in GitHub Desktop.

Revisions

  1. @thepacketgeek thepacketgeek renamed this gist Oct 7, 2013. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. @thepacketgeek thepacketgeek created this gist Sep 24, 2013.
    6 changes: 6 additions & 0 deletions python-post-json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    import requests

    url = "http://localhost:8080"
    data = {'sender': 'Alice', 'receiver': 'Bob', 'message': 'We did it!'}
    headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
    r = requests.post(url, data=json.dumps(data), headers=headers)