Avatar

GetAddresses in Python

0

I have a small problem with Python.  I am trying a GetAddresses call but keep getting TypeError: get() takes 2 positional arguments but 3 were given.

Code: test4 = api.get("GetAddresses",{'coordinates':[{'x':longitude, 'y':latitude}]})

Any advice anyone could give would be helpful.  I know it's got something to do with how I am passing the coordinate values since the TypeError is returning three positional arguments given, I'm just not sure how to break this out.  I have gotten this to work in PHP, just need it to work in Python since we're doing work in both.

Thanks in advance!

Jeremiah

Jeremiah Cook

Please sign in to leave a comment.

4 comments

0
Avatar

Hello Jeremiah,

In your API call you are passing in "GetAddresses" incorrectly. It is being read as a typeName. GetAddressess is not defined in our Python wrapper. You would have to leverage the "call" method defined in our api.py file. 

The API call I believe would look something like so:

api.call("GetAddressess, {'coordinates':[{'x':longitude, 'y':latitude}]})

Wajih Qazi 0 votes
0
Avatar

test4 = api.call('GetAddresses',{'coordinates':[{'x':longitude, 'y':latitude}]}) 

This gives the same result: TypeError: call() takes 2 positional arguments but 3 were given.

Jeremiah Cook 0 votes
0
Avatar

Hello Jeremiah,

I apologize. I am not very familiar with python but I believe the issue is the way we are passing in coordinates.

I reproduced what you are seeing. The following worked for me:

data = {"coordinates":[{"x":longitude, "y":latitude}]}

api.call("GetAddresses", **data)

The data argument is a dictionary and must be unpackaged when used as an argument in the call method.

SO reference: https://stackoverflow.com/questions/44183175/python-init-self-kwargs-takes-1-positional-argument-but-2-were-given

Wajih Qazi 0 votes