获取指定日期的节假日信息

1、接口地址:http://api.goseek.cn/Tools/holiday?date=数字日期
2、返回数据:正常工作日对应结果为 0, 法定节假日对应结果为 1, 节假日调休补班对应的结果为 2,休息日对应结果为 3 
3、节假日数据说明:本接口包含2017年起的中国法定节假日数据,数据来源国务院发布的公告,每年更新1次,确保数据最新
4、示例:
http://api.goseek.cn/Tools/holiday?date=20170528 
返回数据:

{"code":10000,"data":1}     

免费节假日API 开源了,可以离线调用, 可以集成到自己系统中

功能

检查具体日期是否为节假日,工作日对应结果为 0, 休息日对应结果为 1, 节假日对应的结果为 2;(对应支付工资比例分别为 100%, 200% 和 300%,以方便程序计算。计算方法:基本工资* (1+结果数值))
获取具体月份下的节假日情况,只返回休息日或者节假日数据;
可同时传递一个或者多个日期(月份);
支持 2009 年起至 2019 年中国法定节假日,以国务院发布的公告为准,随时调整及增加:http://www.gov.cn/zfwj/bgtfd.htm或http://www.gov.cn/zhengce/xxgkzl.htm
注:当结果为数组时默认返回数据为 json 格式。

开源说明

注:原百度节假日API即为本人提供,后百度apistore禁止个人开发者所以才有此独立接口。鉴于免费版访问量过大对于服务器压力过大现将免费版开源供大家离线调用。

使用说明

下载源码部署到到系统中直接调用?d=日期
离线调用方法
 include(\'include/dateapi.class.php\');
 $api= new dateapi();
 $result= $api->getday($date);
import calendar
from  urllib import request
from random import randrange
import json
import time
 
 
 
year = 2020
data_list = []
for month in range(1,13):
    week_list = calendar.monthcalendar(year,month)
    for i in week_list:
        for j in i:
            if j!=0:
                # 法定节假日信息
                # target_url = "http://www.easybots.cn/api/holiday.php?d=%s%02d%02d"% + current_date
                current_date = "%s%02d%02d"%(year,month,j)
                target_url = "http://api.goseek.cn/Tools/holiday?date=" + current_date
                # target_url = "http://tool.bitefu.net/jiari?date=%s%02d%02d" + current_date
                print(target_url)
                headers = [
                    ("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3"),
                    ("Accept-Encoding", "gzip, deflate"),
                    ("Accept-Language", "zh-CN,zh;q=0.9"),
                    ("Connection", "keep-alive"),
                    ("Host", "api.goseek.cn"),
                    ("Upgrade-Insecure-Requests", 1),
                    ("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36")
                ]
 
                opener = request.build_opener()
                opener.addheaders = headers
                resp = opener.open(target_url).read()
                # resp = request.urlopen(url=target_url).read()
                print(resp)
                res = json.loads(resp)
                res["date"] = current_date
                print(res)
                # resp = str(resp)[2:-1].replace("\"","\'")
                data_list.append(res)
                time.sleep(randrange(2,10))
 
data = json.dumps(data_list)
with open("{}cla.json".format(year),"w",encoding="utf-8") as fp:
    fp.write(data)
 
 
with open("{}cla.json".format(year),"r",encoding="utf-8") as fp:
    a = fp.read()
    b = json.loads(a)
    print(a)
 
for i in b:
    print(i)