I'm trying to interact with the Trakt.tv api, but i'm struggling in create a variable inside a string dictionary.
The api OAuth make a call to the server, that provides 2 access codes, one of those code need to be forwarded to a following server call. like this:
values = """{
"code": "code provide by the api",
"client_id": "code provide by user",
"client_secret": "code provide by user"
}
"""
headers = {
'Content-Type': 'application/json'
}
request = Request('https://api.trakt.tv/oauth/device/token', data=values, headers=headers)
I have the needed code in variable api_code and would like to put this variable inside the string, like the following example.
values = """{
"code": f"api_code",
"client_id": f"user_code",
"client_secret": f"user_code_2"
}
"""
headers = {
'Content-Type': 'application/json'
}
request = Request('https://api.trakt.tv/oauth/device/token', data=values, headers=headers)