Skip to content

Instantly share code, notes, and snippets.

View claudiobusatto's full-sized avatar
💻

Claudio Busatto claudiobusatto

💻
View GitHub Profile
@claudiobusatto
claudiobusatto / post_json_request.py
Created August 24, 2019 14:10
POST request with JSON body in Python using requests library
import requests
import json
url = "http://localhost:8080"
data = {'key': 'value'}
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
r = requests.post(url, data=json.dumps(data), headers=headers)