您的位置:首页 > 编程语言 > Python开发

python 事件 响应 钩子 event hooks

2017-04-06 08:17 302 查看
# -*- coding: utf-8 -*-
import requests

def get_key_info(response, *args, **kwargs):
"""callback function"""
print response.headers['Content-Type']

def main():
"""
主程序

"""
requests.get('http://www.baidu.com', hooks=dict(response=get_key_info))

main()
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: