Skip to content

Commit

Permalink
Resolve TODOs. Bump version.
Browse files Browse the repository at this point in the history
  • Loading branch information
westy92 committed Dec 14, 2022
1 parent 9776b4b commit 39d12b2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
9 changes: 6 additions & 3 deletions holidays/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

class client:
"""The API Client"""

version = '1.0.1'
"""The library version"""

def __init__(self, apiKey: str):
"""Initializes an API client"""
if not apiKey:
Expand Down Expand Up @@ -50,11 +54,10 @@ def search(self, query: str, adult: bool = False) -> SearchResponse:
return self.__request('search', params, SearchResponse)

def __request(self, path, parameters, resultClass):
baseUrl = 'https://api.apilayer.com/checkiday/' # TODO class const
baseUrl = 'https://api.apilayer.com/checkiday/'
headers = {
'apikey': self.apiKey,
# TODO class const, build from version somewhere?
'User-Agent': 'HolidayApiPython/1.0.0',
'User-Agent': f'HolidayApiPython/{self.version}',
}
url = baseUrl + path

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

setup(
name='holiday-event-api',
version='1.0.0',
version='1.0.1',
description='The Official Holiday and Event API for Python',
long_description_content_type='text/markdown',
long_description=readme,
Expand Down
2 changes: 1 addition & 1 deletion test/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def test_sends_user_agent(requests_mock):
client = holidays.client('abc123')
requests_mock.get(
'https://api.apilayer.com/checkiday/events',
request_headers={'user-agent': 'HolidayApiPython/1.0.0'},
request_headers={'user-agent': f'HolidayApiPython/{client.version}'},
text=default,
)
client.getEvents()
Expand Down

0 comments on commit 39d12b2

Please sign in to comment.