API token instead of username:password in python requests.put script

Which authentication schema do you want to use ? Basic Authentication using a token or OAUTH2 using a token ?
According to your post’s content it looks like it would be OAUTH2 ? Then you create a token like described here: [OH3] REST API Authentication Help RESOLVED ?

In case you would like to use Basic Authentication using a token your header is wrong. Look here: Using the API Token with python - #16 by ysc

Both threads give a bit more background information.

You wrote

is that different using tokens in the script ?