First Post - Trouble Authenticating with Nightbot API

I’m trying to write a python script that will pull some data from Nightbot through the API and eventually write that data to a .txt file so I can display it on screen while streaming.

However, I’ve run into problems authenticating with the API. Every time I run the script, I get a 400 error back. I know that my syntax is probably wrong somewhere but I can’t seem to figure out what’s wrong here.

import requests
import json

##Authorization POST Request
# defining the api-endpoint  

# your API key here 
DATA = {'grant_type':"client_credentials", 'client_id' : 'CLIENT_ID', 'client_secret' : 'CLIENT_SECRET', 'scope': 'commands'}

# sending post request and saving response as response object 
r =, data=DATA)

Nevermind, I’m an idiot. Obviously you can’t put variable names in quotes and expect them to work.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.