Compare commits
2 Commits
edr-dev-as
...
master
| Author | SHA1 | Date |
|---|---|---|
|
|
20740e836e | |
|
|
5a9eec02ad |
|
|
@ -165,3 +165,42 @@ class Event():
|
|||
return response.json(), response.status_code
|
||||
except: # pylint: disable=bare-except
|
||||
return None, response.status_code
|
||||
|
||||
|
||||
def patch_v3(self, event_key, patch_data):
|
||||
"""
|
||||
patch_v3 Path the Event V3.
|
||||
|
||||
:param event_key: The Event key to update with API
|
||||
:param patch_data: The data to update the Event
|
||||
"""
|
||||
|
||||
# Set the headers for the request
|
||||
headers = {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'Authorization': f'Bearer {self.jwt}'
|
||||
}
|
||||
|
||||
# Set the key to the patch data
|
||||
patch_data['key'] = event_key
|
||||
|
||||
# Run the GET
|
||||
response = requests.patch(
|
||||
f'{self.base_url}/api/v1/events/{event_key}',
|
||||
headers=headers,
|
||||
timeout=30,
|
||||
json=patch_data
|
||||
)
|
||||
|
||||
# Good response. Return Event
|
||||
if response.ok:
|
||||
return response.json(), response.status_code
|
||||
|
||||
# Log error and retunr null
|
||||
logging.error("[AFEVENT UPDATE] [%s]", response.text)
|
||||
|
||||
try:
|
||||
return response.json(), response.status_code
|
||||
except: # pylint: disable=bare-except
|
||||
return None, response.status_code
|
||||
|
|
|
|||
6
setup.py
6
setup.py
|
|
@ -9,7 +9,7 @@ with open('README.md', 'r') as f:
|
|||
|
||||
setup(
|
||||
name='lib_af_api',
|
||||
version='1.0.4',
|
||||
version='1.0.5',
|
||||
author='',
|
||||
author_email='',
|
||||
description='',
|
||||
|
|
@ -20,7 +20,7 @@ setup(
|
|||
packages=find_packages(),
|
||||
python_requires='>=3.7',
|
||||
install_requires=[
|
||||
'pytz==2024.1',
|
||||
'requests==2.31.0'
|
||||
'pytz>=2024.1',
|
||||
'requests>=2.32.3'
|
||||
],
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue