import requests
import json
url = 'https://snippets.glot.io/snippets'
headers = {
'Authorization': 'a9d83a42-73bb-473b-b19e-4d57c1961c49',
'Content-type': 'application/json'
}
data = {
"language": "python",
"title": "test",
"public": True,
"files": [
{
"name": "POST.py",
"content": open('glot.py').read()
}
]
}
r = requests.post(url, data=json.dumps(data), headers=headers)
print(r.text)