聚合数据api接入-Python版本

版权声明:本文为博主原创文章,未经博主允许不得转载。如有侵权,请联系本人进行删除,谢谢! https://blog.csdn.net/dongdong0071/article/details/79299210
#!/usr/bin/python
# -*- coding: utf-8 -*-
import json, urllib
from urllib.parse import urlencode
import requests

def main():
    # 配置您申请的APPKey
    appkey = "624ff8635d4b228de27cd8591ebbf854"
    mydate = "2017-2-16"
    # 1.获取当天的详细信息
    request1(appkey, mydate)

# 获取当天的详细信息
def request1(appkey,mydate):
    url = "http://v.juhe.cn/calendar/day"
    payload = {
        "key": appkey,  # 您申请的appKey
        "date":mydate,  # 指定日期,格式为YYYY-MM-DD,如月份和日期小于10,则取个位,如:2012-1-1
    }
    f = requests.get(url,params=payload)
    print(f.url)
    print(f.text)

if __name__ == '__main__':
    main()

猜你喜欢

转载自blog.csdn.net/dongdong0071/article/details/79299210