I have an API I'd like to query with multiple values for the same parameter. This is an example of my code:
import requests
headers = {
"apikey": "apikey"}
params = (
("gl","US"),
("hl","en"),
("q", "value")
)
response = requests.get('url', headers=headers, params=params)
print(response.text)
I tried changing "q" in the parameters to a variable, and putting the values for "q" into a list, and then into a tuple.
Example below:
import requests
query = [1, 2, 3, 4, 5)
headers = {
"apikey": "apikey"}
params = (
("gl","US"),
("hl","en"),
("q", {value})
)
response = requests.get('url', headers=headers, params=params)
print(response.text)
I got an error about not being able to iterate over an unhashable object, and then a genericAlias error with the tuple.