yospan

yospan

V2EX 第 48286 号会员,加入于 2013-10-30 13:12:30 +08:00
根据 yospan 的设置,主题列表被隐藏
二手交易 相关的信息,包括已关闭的交易,不会被隐藏
yospan 最近回复了
2017-12-09 15:19:00 +08:00
回复了 shanechiu 创建的主题 Python how could I set cookie followed by a redirect request?
之前刚做了,用 session 啊,统计后台设置个第三方密码,然后 post 给他,保持 session 去请求其他页面,接着统计里的数据随便拿~ 那去参考下把;我是 py 新手;

```
##百度统计的第三查看密码,登录并获得 session 和 siteid
idwd = {'passwd': '66666'}
S = Session()
logined = S.post("https://tongji.baidu.com/web/welcome/ico?s=8dfdafdafadfa4bccd", data=idwd, headers=REQ_HEADERS)

#获得 siteid,并转换成字符串
siteid= str(logined.url.split("=")[1])
webid = str(logined.url.split("/")[4])



##搜索词的 post 参数
keyjson = {"siteId":siteid,"st":"","et":"","st2":"","et2":"","indicators":"['pv_count','visitor_count','ip_count','bounce_ratio','avg_visit_time']","order":"pv_count,desc","offset":"","pageSize":"","target":"-1","flag":"indicator","source":"","isGroup":"0","clientDevice":"all","reportId":"12","method":"source/searchword/a","queryId":""}

readkeyjson = S.post("https://tongji.baidu.com/web/"+webid+"/ajax/post", data=keyjson, headers=REQ_HEADERS)


#按文本读取
jsondata = readkeyjson.text
#格式化 json
readjsondict = json.loads(jsondata)

keyNamejson = readjsondict['data']['items'][0]
for items in keyNamejson:
items2 = items
print(items2[0]['name'])

```
@263 装了 firestream,掉线频繁

@tony1016 上面那篇 homebrew 装 samba 已经失效了,没玩过 homebrew,装的时候 brew install samba 提示没这个包,官方也去看了 fomular 什么的里面也没有;还有其他办法装 samba 不?

谢谢 2 位大神回答
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2848 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 10ms · UTC 09:53 · PVG 17:53 · LAX 02:53 · JFK 05:53
Developed with CodeLauncher
♥ Do have faith in what you're doing.