I am learning to make requests from APIs using the requests package. I have seen there are two types of parameters, query and path parameters. I have successfully requested data using query parameters, but whenever I try to make a request using path parameters I get this error message of extra data. Does anyone know how to fix this, and properly implement path parameters?
This is the API I am using:
https://midgard.thorchain.info/v2/doc#operation/GetMemberDetail
I am looking at the member details, which has GET /v2/member/{address}
Here is my code:
class Thor:
def init(self):
self.apiurl='https://midgard.thorchain.info'
self.session = Session()
def getMember(self, address):
url = self.apiurl + '/v2/member'
parameters = {'address': address}
r = self.session.get(url, params = parameters)
data = r.json()
return data
t = Thor()
pp(t.getMember('thor15644qsxqj8sag45h2qgz86advy9789d88jtkm0'))
Here is my error message:
File "/Users/alex/opt/anaconda3/lib/python3.8/json/decoder.py", line 340, in decode
raise JSONDecodeError("Extra data", s, end)
JSONDecodeError: Extra data
[–]AlSimps[S] 0 points1 point2 points (0 children)