I know this isn’t a POST, but this thread could use a bump as things have changed a bit. You’ll notice in the example spark.io is still being called. This should now be particle.io. I have included a sample get request that will help “get” folks started.
I am using the dotenv python package to manage my sensitive data in a .env file located at the same level as the script in the file system. I’d highly recommend this practice so that you can commit your code without worrying about accidentally committing sensitive data.
import os
from dotenv import load_dotenv
import requests
load_dotenv()
access_token = os.getenv("ACCESS_TOKEN")
device_id = os.getenv("DEVICE_ID")
#Sample GET request
address = 'https://api.particle.io/v1/devices/{0}'.format(device_id)
headers = {'Authorization':'Bearer {0}'.format(access_token)}
get = requests.get(address, headers=headers)
print(get.text)