0

我正在使用Requests具有 NTLM 身份验证支持的 Python 库

import requests
from requests_ntlm import HttpNtlmAuth


url = 'http://ManufacturingRequests/AllItems.aspx'
username = 'domain\user'
password = 'pass'

r = requests.get(url,auth=HttpNtlmAuth(username,password))
print r.text.encode('utf-8')

我正在获取的 URL 的 HTML 看起来像

<input type="button"
   name="Button" 
   value="OK"
   onclick="if (!PreSaveItem()) return false;WebForm_DoPostBackWithOptions(new   WebForm_PostBackOptions(&quot;Button;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, true))" 
   id="ctl00_PlaceHolderMain_g_6b9c5d27_394f_4ab7_9c54_1b7507fd14a1_savebutton1_ctl00_diidIOS    veItem"
   accesskey="O" 
   class="ms-ButtonHeightWidth" 
   target="_self"
>

如何单击按钮(提交按钮表单)?

toPost = {'Button': 'submitForm'}
r = requests.post(url, data=toPost)
4

0 回答 0