I was able to use your code to generate my own token with a trial account. The only thing I can see is you might need to double check your keys and secrets. Double check the following:
ACCOUNT_SID = your account
SID API_KEY = api key
SID API_SECRET = secret from the API Key you created