requests - python
Make a POST request with data
# Instead of using the data keyword, use json and pass in a dictionary directly
resp = requests.post(f"https://api.digitalocean.com/v2/droplets",
headers={
"Content-Type": "application/json",
"Authorization": f"Bearer {do_token}",
},
json={
"name": name,
"region": region,
"size": size,
"image": image,
"ssh_keys": [SSH_FINGERPRINT],
"tags": tags
}
)