Skip to content

Commit

Permalink
Update Mobilize connector URI, fix display of errors, fix auth issue (#…
Browse files Browse the repository at this point in the history
…708)

* Raises readable errors when unsuccessful status codes returned

* Remove extra space for linting purposes

* Switch URI to working one

* Add trailing slash to mobilize uri

* Fix auth issue in request_paginate
  • Loading branch information
shaunagm authored Jul 9, 2022
1 parent 6c294ed commit baabd1b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions parsons/mobilize_america/ma.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

logger = logging.getLogger(__name__)

MA_URI = 'http://events.mobilizeamerica.io/api/v1/'
MA_URI = 'https://api.mobilize.us/v1/'


class MobilizeAmerica(object):
Expand Down Expand Up @@ -44,6 +44,8 @@ def _request(self, url, req_type='GET', post_data=None, args=None, auth=False):

r = _request(req_type, url, json=post_data, params=args, headers=header)

r.raise_for_status()

if 'error' in r.json():
raise ValueError('API Error:' + str(r.json()['error']))

Expand All @@ -57,7 +59,7 @@ def _request_paginate(self, url, req_type='GET', args=None, auth=False):

while r.json()['next']:

r = self._request(r.json()['next'], req_type=req_type)
r = self._request(r.json()['next'], req_type=req_type, auth=auth)
json.extend(r.json()['data'])

return json
Expand Down

0 comments on commit baabd1b

Please sign in to comment.