How can we make it easier for you to develop on top of Wild Apricot?

API V2 authentication and sample routines in Python


I'm trying to integrate my Wild Apricot database into a standing Python program. If somebody has already written the V2 API authentication and some routines in Python, can they share so I can leverage?

Thanks in advance.

0 votes
Sign in
Sign in with: facebook google
Signed in as (Sign out)

We’ll send you updates on this idea

czarchua shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →


Sign in
Sign in with: facebook google
Signed in as (Sign out)
  • Eric commented  ·   ·  Flag as inappropriate

    The example code at:
    does not compile with either python2 or python3. It appears to want to use the python3 urllib library, but complains about:

    File "/home/eric/wild_apricot/ApiSamples/python/", line 70, in authenticate_with_contact_credentials
    request = urllib.request.Request(self.auth_endpoint, encoded_data, method="POST")
    TypeError: __init__() got an unexpected keyword argument 'method'

    "method=xxx" is not an argument for urllib.request.Request(). So apparently it actually does <i>not</i> work.

  • Chris Hailey commented  ·   ·  Flag as inappropriate


    I have been using a Python V2.7 adaptation of your sample code. It was working fine until about a week ago (14th June), then overnight it stopped working, raising an exception when I tried to print out the authentication token details, which is an ApiObject instance:

    self._token = WaApiClient._parseResponse(response)

    if self._verbose: _statusErrMsg('info', 'authentAppKey()', self._token)

    The code is failing when trying to execute the __str__ method of the ApiObject because it considers the data invalid: File "D:\ourData\progLan\python\", line 418, in __str__ return json.dumps(self.__dict__) File "C:\Python27\lib\json\", line 231, in dumps return _default_encoder.encode(obj) File "C:\Python27\lib\json\", line 201, in encode chunks = self.iterencode(o, _one_shot=True) File "C:\Python27\lib\json\", line 264, in iterencode return _iterencode(o, 0) File "C:\Python27\lib\json\", line 178, in default raise TypeError(repr(o) + " is not JSON serializable")TypeError: {"AvailableScopes": ["account_view", "contacts_view", "event_registrations_view", "events_view", "finances_view", "membership_levels_view"], "AccountId": 123456} is not JSON serializable

    This started the day before the new API V2 authentication changes were applied. I have waited a week and since modified the code to use the new authentication protocol but the error persists. This is not a significant problem for me because I have trapped the error, but should it be raised in the first place? I use the same technique in several other methods but none of them trigger this exception so it is probably specific to the authentication token data.

  • AdminDmitry Smirnov (Product Owner, Wild Apricot by Personify) commented  ·   ·  Flag as inappropriate


    I've just published sample python code on github:

    I'm not a python guru and this code is not a masterpiece, however it works. There are 2 files: is a python module, which helps to work with API is a demo, which downloads account information, downloads 10 active members and print their details creates new contact archives this contact

Feedback and Knowledge Base