Cannot use the API Key

If you already have an username and you generated an API key, then delete the line
tls.set_credentials_file(“myusername”, “my_API_Key”) from your code.

In case you haven’t a Plotly account yet, read this answer to similar question: