Forums / Support / Halo API Support

Python - space in the gamertag

OP Diknak

How do I handle a space in the gamertag in my GET request? I'm getting a 400 error. I tried passing with a space and with a %20 and I'm not sure were to go from here.

season_url = "/stats/h5/servicerecords/arena?players={gamertag}&%s"
...
conn = httplib.HTTPSConnection('www.haloapi.com')
conn.request("GET", season_url % params, "{body}", headers)
response = conn.getresponse()
data = json.loads(response.read())
solved: I needed to add a +, not %20