Normally I don't use backslashes in my strings because it complicates things. In this case I don't have a choice as a black slash \ is within a token ive been given and I'm trying to pass in a url request.
Here is an example of what I'm seeing, ive tried double quotes, using repr() , escaping it but the results still show either double \ or something that doesnt represent the key.
token ="ABC\$DEfg"
headers = {'content-type': 'application/json', 'Authorization': 'TOK:'+token+'', 'Accept': 'application/json'}
print ('Headers are = {0}'.format(headers))
Even though I used double quotes this is the result when I try to run the script above :
Headers are = {...'Authorization': 'TOK:ABC\\$DEfg'}
It should be ABC\$DEfg not ABC\$DEfg'
How best should I be inserting token into my request and maintain a normal single back slash. Also the token can change so I would like way to wrap the variable correctly