# encoding=utf-8
import requests
import json
import urllib.request
import datetime
import time
# 定义时间参数
time_now = datetime.datetime.now()
now_d = time.strftime("%Y-%m-%d")
ytd_d = (time_now + datetime.timedelta(days=-1)).strftime("%Y-%m-%d")
# print(ytd_d)
def get_content(url):
'获取网页内容'
html = urllib.request.urlopen(url)
content = html.read()
html.close()
return content
def getAccess_token(AppID,AppSecret):
'获取微信唯一标识ACCESS_TOKEN,access_token是公众号的全局唯一票据'
url="https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid="+AppID+"&secret="+AppSecret
info=get_content(url)
access_token=json.loads(info)["access_token"]
# print(access_token)
return access_token
def getUser(access_token,ytd_d):
"用户分析数据接口"
r_date = {'begin_date':ytd_d,
python爬取wx公众号粉丝数
最新推荐文章于 2024-05-27 17:00:50 发布