【发布时间】:2018-08-27 02:55:49
【问题描述】:
对于 Python 中的一般 POST 请求,例如:
>>> import requests
>>> r = requests.post(url=url, data=data, headers = headers, cookies = cookies)
>>> type(r)
<class 'requests.models.Response'>
是否可以获取发出请求时使用的 ip 地址?我尝试使用dir(r) 查看其内容并得到:
dir(r)
['attrs', 'bool', 'class', 'delattr', '字典', 'dir', 'doc', 'enter', 'eq', 'exit', '格式', 'ge', 'getattribute', 'getstate', 'gt', 'hash', 'init'、'init_subclass'、'iter'、'le'、'lt', 'module', 'ne', 'new', 'nonzero', 'reduce', 'reduce_ex'、'repr'、'setattr'、'setstate'、 'sizeof', 'str', 'subclasshook', 'weakref', '_content'、'_content_consumed'、'_next'、'apparent_encoding'、 '关闭','连接','内容','cookies','经过','编码', '标题','历史','is_permanent_redirect','is_redirect', 'iter_content', 'iter_lines', 'json', '链接', 'next', 'ok', 'raise_for_status'、'raw'、'reason'、'request'、'status_code'、'text'、 '网址']
这里有什么东西可能包含它吗?谢谢。
【问题讨论】:
标签: python python-3.x post