Trying to fetch currency quotes from Oanda's API. Here is the code I have:
s = requests.Session()
url = "https://stream-fxpractice.oanda.com/v1/prices"
headers = {'Authorization': 'Bearer ' + access_token}
params = {'instruments': pairs_oanda, 'accountId': account_id}
resp = s.get(url, headers=headers, params=params, stream=True)
The access_token and account_id are authentication for the API. When I supply one currency pair, for instance "EUR_USD", to pairs_oanda it works fine, resulting in the following url:
https://streamfxpractice.oanda.com/v1/prices?instruments=GBP_USD&accountId=*******
However, when I supply a list of currency pairs, for instance
["EUR_USD", "GBP_USD"]
to pairs_oanda, I get this URL:
https://stream-fxpractice.oanda.com/v1/prices?instruments=EUR_USD&instruments=GBP_USD&accountId=*******
However, what I need the url to look like to properly access the API is this:
https://stream-fxpractice.oanda.com/v1/prices?instruments=EUR_USD%2CGBP_USD&accountId=*******
Is there anyway to get Requests to parse the list differently?