Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python,发送带有头和cookie的请求_Python_Cookies_Header_Request_Python Requests - Fatal编程技术网

Python,发送带有头和cookie的请求

Python,发送带有头和cookie的请求,python,cookies,header,request,python-requests,Python,Cookies,Header,Request,Python Requests,向需要身份验证才能下载文件的服务器发送python请求。我正在尝试发送一个cookie和一个带有请求的头。发送此请求的正确格式是什么 从chrome developer中,我可以看到请求头: python请求: Session = requests.Session() cookies = browser.get_cookies() response = Session.get(url) tt = "ASPSESSIONIDSGSRSATR" cookie = {tt:Session.coo

向需要身份验证才能下载文件的服务器发送python请求。我正在尝试发送一个cookie和一个带有请求的头。发送此请求的正确格式是什么

从chrome developer中,我可以看到请求头:

python请求:

Session = requests.Session()
cookies = browser.get_cookies()

response = Session.get(url)

tt = "ASPSESSIONIDSGSRSATR"
cookie = {tt:Session.cookies.get_dict().get(tt,""),
          cookies[2].get("name",""):cookies[2].get("value",""),
          cookies[0].get("name",""):cookies[0].get("value","")}


header = {"Host":"ecsxxxxxxxxxxxxxxxxxxxxx",
          "Connection": "keep-alive",
          "Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
          "User-Agent":"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.89 Safari/537.36",
          "Referer":"https://ecsxxxxxxxxxxxxxxxxxxxxx",
          "Accept-Encoding":"gzip, deflate, sdch",
          "Accept-Language":"en-US,en;q=0.8,fr;q=0.6"}

response = Session.get(url, cookies = cookie, headers = header)
评论:。。。如何接受用户名/密码

Kerberos基础

在服务器上设置Kerberos身份验证时,有两种基本的操作模式。
从客户机实现的角度来看,最简单的方法就是使用基本身份验证将用户名和密码传递给服务器,然后服务器使用Kerberos领域检查用户名和密码


注释:它是一个kerberos服务器

有一个可选选项

此库添加了可选的Kerberos/GSSAPI身份验证支持,并支持相互身份验证

基本获取用法:

import requests
from requests_kerberos import HTTPKerberosAuth
r = requests.get("http://example.org", auth=HTTPKerberosAuth())
因此:

评论:。。。如何接受用户名/密码

Kerberos基础

在服务器上设置Kerberos身份验证时,有两种基本的操作模式。
从客户机实现的角度来看,最简单的方法就是使用基本身份验证将用户名和密码传递给服务器,然后服务器使用Kerberos领域检查用户名和密码


注释:它是一个kerberos服务器

有一个可选选项

此库添加了可选的Kerberos/GSSAPI身份验证支持,并支持相互身份验证

基本获取用法:

import requests
from requests_kerberos import HTTPKerberosAuth
r = requests.get("http://example.org", auth=HTTPKerberosAuth())

所以:

您知道服务器使用的身份验证类型吗?不知道。我如何找到它?如果知道,它是Oracle EMC服务器helps@stovfl,这是通过本地代理服务器进行的。这个问题是为了验证从外部服务器下载的内容。@MalcolmMurdoch它是kerberos服务器您知道服务器使用的验证类型吗?不知道。我如何找到它?如果知道,它是Oracle EMC服务器helps@stovfl,这是通过本地代理服务器进行的。这个问题是为了验证从外部服务器下载的内容。@MalcolmMurdoch这是一个kerberos服务器,我今天早上在玩这个库,但它如何接受用户名/pword?我今天早上在玩这个库,但它如何接受用户名/pword?