Compare commits

...

8 commits

Author SHA1 Message Date
c3f02c4ecb
chore: update license, bump version 2024-08-09 16:07:05 -05:00
0b00bcf471
Merge pull request #4 from chr1st0ph3rGG/master
Update setup.py
2024-08-09 16:04:14 -05:00
Christopher Schmitt
2b49d85ad4
Update setup.py 2024-06-04 22:29:59 +02:00
a2c5190805
chore: cleanin' and bumpin'
* Updated copyright years / company name on LICENSE.
* Fixed up spacing in the README.
* Bumped version number.
2019-04-19 22:58:53 -05:00
6e92b65a9a
Merge pull request #2 from narudarurarasya/master
make code work with python 3.x
2019-04-19 22:51:35 -05:00
Kevad
15e629786a make code work with python 3.x
also some minor code refactor
2017-05-18 16:47:45 +02:00
Josh Sherman
5fabca70a2 Merge pull request #1 from zachyordy/documentation-changes
Minor Fixes to README.md
2017-01-06 13:46:14 -06:00
Zach Yordy
1ab665230a Changed true to True as Python constant. Removed semi-colons as not used in Python. Fixed name of pip package. Put single quotes around parameters as not variables. 2017-01-06 10:33:24 -05:00
4 changed files with 23 additions and 21 deletions

View file

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2016 Josh Sherman
Copyright (c) 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024 Gravity Boulevard, LLC
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View file

@ -4,7 +4,7 @@ Official Python library for Holiday API
## Installation
```shell
pip install holidayapi
pip install python-holidayapi
```
## Usage
@ -16,16 +16,16 @@ hapi = holidayapi.v1('_YOUR_API_KEY_')
parameters = {
# Required
country: 'US',
year: 2016,
# Optional
# month: 7,
# day: 4,
# previous: true,
# upcoming: true,
# public: true,
# pretty: true,
'country': 'US',
'year': 2016,
# Optional
# 'month': 7,
# 'day': 4,
# 'previous': True,
# 'upcoming': True,
# 'public': True,
# 'pretty': True,
}
holidays = hapi.holidays(parameters);
holidays = hapi.holidays(parameters)
```

View file

@ -2,23 +2,22 @@ import json
import requests
class v1:
key = None
def __init__(self, key):
self.key = key
def holidays(self, parameters):
url = 'https://holidayapi.com/v1/holidays?'
if parameters.has_key('key') is False:
if not parameters.get('key'):
parameters['key'] = self.key
else:
assert self.key == parameters['key'], 'keys supplied as an argument & in `parameters` differ. \n Provide at only one place'
response = requests.get(url, params=parameters);
data = json.loads(response.text)
data = response.json()
if response.status_code != 200:
if data.has_key('error') is False:
if not response.ok:
if not data.get('error'):
data['error'] = 'Unknown error.'
return data

View file

@ -2,13 +2,16 @@ from setuptools import setup
setup(
name='python-holidayapi',
version='1.0.0',
version='1.2.0',
description='Official Python library for Holiday API',
url='https://holidayapi.com',
author='Josh Sherman',
author_email='hello@holidayapi.com',
keywords=['python','holidayapi','holiday','api'],
license='MIT',
packages=['holidayapi']
packages=['holidayapi'],
install_requires=[
'requests',
],
)