我是Python新手;目前,我需要将下面的R代码转换为Python,我知道我需要使用请求库;但是,我不知道如何将authenticate(cibc_username, cibc_password,"gssnegotiate")
转换成Python。那么,有人能帮我解决这个问题吗
R代码如下:
hr_page = GET(url, user_agent("""Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko\)
Chrome/70.0.3538.77 Safari/537.36"""), authenticate(cibc_username, cibc_password,"gssnegotiate"), timeout(20000))
我写的是:
headers = {'User-Agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"}
data = {'username':cibc_username, 'password':cibc_password}
hr_page = requests.get(url, headers = headers, data = data, timeout = 20000)
如果auth方法确实是
gssapi
,则可能需要使用来自requests_negotiate
的HTTPNegotiateAuth
:更多信息here
相关问题 更多 >
编程相关推荐