get_holiday_cn
获取中国法定节假日
支持的python版本
python3.x
功能点
- 传入日期获取中国法定节假日
说明
安装
pip install get_holiday_cn
数据说明
{
"code": 0, // 0服务正常。-1服务出错
"type": {
"type": enum(0, 1, 2, 3), // 节假日类型,分别表示 工作日、周末、节日、调休。
"name": "周六", // 节假日类型中文名,可能值为 周一 至 周日、假期的名字、某某调休。
"week": enum(1 - 7) // 一周中的第几天。值为 1 - 7,分别表示 周一 至 周日。
"status": enum(0, 1) // 数据场景类型,0来源于仓库中的节假日或调休日;1表示当前传入日期在仓库中未查询到,直接走系统计算,可能为工作日或还未公布的节假日。
},
"holiday": { // 只有当type为2,3时,该对象才存在
"holiday": false, // true表示是节假日,false表示是调休
"name": "国庆节调休", // 节假日的中文名。如果是调休,则是调休的中文名,例如'国庆节调休'
"date": '2021-10-09' // 当前请求的日期
}
}
使用
from get_holiday_cn.client import getHoliday
client = getHoliday()
# 获取今日数据
print(client.assemble_holiday_data())
# 指定日期获取数据
print(client.assemble_holiday_data(today='2021-10-01'))
2022/12/27 更新说明
刚刚推送了v1.0.5版本,在此版本前可能会获取到空数组的2023年json文件,导致现在23年假期更新后还是无法查到;如出现下图所示,可以删除本地已缓存的2023.json文件,下次再请求时会自动获取最新的数据
2024/04/29 更新说明
本次版本号v1.0.6,主要修复 issues-4 的问题,在项目中增加了某个年份文件中返回空列表的情况判断
Metadata
Release files for get-holiday-cn 1.0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| get_holiday_cn-1.0.8.tar.gz | 6.4 kB | Without provenance | Details for get_holiday_cn-1.0.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| get_holiday_cn-1.0.8-py3-none-any.whl | Python 3 | none | any | Details for get_holiday_cn-1.0.8-py3-none-any.whl |
Total release size: 13.9 kB
Release files / get_holiday_cn-1.0.8.tar.gz
| Download URL | get_holiday_cn-1.0.8.tar.gz |
|---|---|
| Size | 6.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
251ca19e4f7260049be0feaf6c26cecaee89fb0486b9882b4194f6dd9987f3ed
|
|
BLAKE2b-256 checksum How to use checksums |
f9eaa283a735996f87e630d64e7c26babff3c2a9e8f802cee4abc2320b1ada5f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / get_holiday_cn-1.0.8-py3-none-any.whl
| Download URL | get_holiday_cn-1.0.8-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3ee0b6e405813f442b9338e214c5ddf0523ec1c7cd72d1e9034940860e6afbd4
|
|
BLAKE2b-256 checksum How to use checksums |
9961a079336c516edbfb1a98bc450eeb5676617b8ba2829c220cf568f09636ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Security for get-holiday-cn 1.0.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.