Compare commits

..

No commits in common. "6f5664346657754c75002df910efe983bdf7e89d" and "898c195ede527c6bd8daf6351edd3c78eee57224" have entirely different histories.

3 changed files with 9 additions and 40 deletions

View File

@ -21,40 +21,6 @@ class Event():
self.jwt = jwt
def get_all(self, args = None):
"""
get_all Get the events
:param args: Dict of args to add as URL params
"""
# Set the headers for the request
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': f'Bearer {self.jwt}'
}
if not isinstance(args, dict):
args = {}
# Run the GET
response = requests.get(
f'{self.base_url}/api/v1/events',
params=args,
headers=headers,
timeout=300
)
# Good response. Return Events
if response.ok:
return response.json()
# Log error and retunr null
logging.error("[AFEVENT GET ALL] [%s]", response.text)
return None
def get(self, event_key):
"""
get Get the event

View File

@ -23,7 +23,7 @@ class Voter():
def get_all(self, args = None):
"""
get_all Get the voter
get Get the voter
:param args: Dict of args to add as URL params
"""
@ -35,13 +35,16 @@ class Voter():
'Authorization': f'Bearer {self.jwt}'
}
if not isinstance(args, dict):
args = {}
url_args = ""
prefix = ""
if isinstance(args, dict):
for k in args:
url_args += f"{prefix}{k}={args[k]}"
prefix = "&"
# Run the GET
response = requests.get(
f'{self.base_url}/api/v1/voters',
params=args,
f'{self.base_url}/api/v1/voters?{url_args}',
headers=headers,
timeout=300
)

View File

@ -9,7 +9,7 @@ with open('README.md', 'r') as f:
setup(
name='lib_af_api',
version='0.1.5',
version='0.1.4',
author='',
author_email='',
description='',