By the time it was completed, cookies baked 20 million copies.
Find out if today is a holiday using the Google Calendar v3 API. The feature is that the API query result is stored in the class cache, so even if it is called 10,000 times, it will respond within 1 second. https://pypi.python.org/pypi/japan_holiday
install
pip install japan_holiday
#Determine if today is a holiday(today is holiday)
from japan_holiday import JapanHoliday
JapanHoliday(google_api_token).today()
>>>False
#Determine if today is a holiday or weekend(today is holiday or weekend)
JapanHoliday(google_api_token).today(weekend=True)
>>>True
#Determine if the designated date is a holiday or weekend(the chosen day is holiday or weekend)
from datetime import datetime
now = datetime(2016, 1, 8, 00, 00, 00)
JapanHoliday(google_api_token).check(now=now, weekend=True)
>>>True
# list
JapanHoliday(google_api_token).get_holiday_calender(2015)
>>>[New Year's Day:2015/1/1,Coming of age day:2015/1/12,Foundation Day:2015/2/11,Vernal Equinox Day:2015/3/21,Showa Day:2015/4/29,Constitution Memorial Day:2015/5/3,Greenery day:2015/5/4,Children's day:2015/5/5,Constitution Memorial Day 振替休日:2015/5/6,Marine day:2015/7/20,Respect for the aged day:2015/9/21,National holiday:2015/9/22,Autumnal Equinox Day:2015/9/23,Health and sports day:2015/10/12,Culture Day:2015/11/3,Labor Thanksgiving Day:2015/11/23,The emperor's birthday:2015/12/23]
I already knew that a similar library would exist, but I needed a Google API token to use it. Find out how tokens aren't needed [XML feeds](https://www.google.com/calendar/feeds/japanese__ja%40holiday.calendar.google.com/public/basic?start-min=2015-10 -01 & start-max = 2015-12-31 & alt = json) It seems that it is not necessary. Development has started in earnest.
[XML feed](https://www.google.com/calendar/feeds/japanese__ja%40holiday.calendar.google.com/public/basic?start-min=2015-10-01&start-max=" when it is almost completed If you take a closer look at 2015-12-31 & alt = json) ...
I decided to change direction and use tokens to hit the API. With this, it is not possible to differentiate from the existing library, but the typical syndrome that cannot be cut off is developed. Since there is no help for it, I tried to make it different by focusing on the three points of writing the document properly, making the direction simpler and faster.
I'm straying because it's quite useless. Design and verification are important.
The mechanism of pip is very convenient and wonderful, but from the registrant's point of view, it was quite shit. If you think that you can easily register because the procedure is scattered on the WEB, [Save the registration ID and password in plain text on the PC](http://stackoverflow.com/questions/1569315/setup-py-upload- is-failing-with-upload-failed-401-you-must-be-identified-t), or the standard way of writing setup.py is not maintained. However, since it is a convenient mechanism that blows away such a trivial disadvantage, it seems that it will be used for a long time (pip becomes the standard installer from Python 3.4 !?). Hey.
There are various ways to write setup.py, so I was very confused at first. If you get lost, you can enjoy it by referring to requests and redis.
Finally, when registering for PyPi, I would like to conclude by introducing what I thought was the one who did this.
The module name has failed. You will write this when importing.
from japan_holiday import JapanHoliday
Underscore is unpleasant, so I'd like to be careful next time.
You can write everything in English, but especially with a domestic library like this one, the countries where it is expected to be used are limited, so try entering Japanese keywords so that you can get caught when searching in Japanese. It was. Maybe this story has its pros and cons.
README.Centrally manage rst on PyPi and GitHub
import os
f = open(os.path.join(os.path.dirname(__file__), 'README.rst'))
long_description = f.read()
f.close()
setup(
long_description=long_description,
...
Reference: https://github.com/andymccurdy/redis-py/blob/master/setup.py#L30
Centrally manage version with PyPi and module
# 1. init.To py__version__ = '0.0.5'Write
# 2. setup.Call with py
from redis import __version__
...
setup(
name='redis',
version=__version__,
...
Reference: https://github.com/andymccurdy/redis-py/blob/master/setup.py#L5
English is spicy. If you don't know what to write, you can write it by referring to requests. requests GitHub requests PyPi
python setup.py sdist upload
Recommended Posts