Should actually use requests session for web api...
This commit is contained in:
parent
baadb86d5d
commit
ebf1e6eb60
|
@ -38,7 +38,6 @@ class NationBuilderWebAPI(object):
|
||||||
max_retries=None, **kwargs):
|
max_retries=None, **kwargs):
|
||||||
self.config = config
|
self.config = config
|
||||||
self.app = self.config.get_app()
|
self.app = self.config.get_app()
|
||||||
self.session = None
|
|
||||||
|
|
||||||
self.base_url = base_url or self.config.require(
|
self.base_url = base_url or self.config.require(
|
||||||
'nationbuilder', 'api.base_url')
|
'nationbuilder', 'api.base_url')
|
||||||
|
@ -69,8 +68,8 @@ class NationBuilderWebAPI(object):
|
||||||
params['access_token'] = self.access_token
|
params['access_token'] = self.access_token
|
||||||
|
|
||||||
if request_method == 'GET':
|
if request_method == 'GET':
|
||||||
response = requests.get('{}/{}'.format(self.base_url, api_method),
|
response = self.session.get('{}/{}'.format(self.base_url, api_method),
|
||||||
params=params)
|
params=params)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError("unknown request method: {}".format(
|
raise NotImplementedError("unknown request method: {}".format(
|
||||||
|
|
Loading…
Reference in a new issue