我使用下面的代码使用VB.NET从URL获取html
Dim strURL As String = "https://abcdef.com/page.aspx"
Dim strOutput As String = ""
Dim wrResponse As WebResponse
Dim wrRequest As WebRequest = HttpWebRequest.Create(strURL)
wrRequest.UseDefaultCredentials = True
wrResponse = wrRequest.GetResponse()
我想在Python中实现相同的功能:
import requests
x = requests.get('https://abcdef.com/page.aspx',verify=False)
print(x.text)
但我得到的回答是:
<h2>401 - Unauthorized: Access is denied due to invalid credentials.</h2>
<h3>You do not have permission to view this directory or page using the credentials that you supplied.
</h3>
这不起作用,因为站点需要凭据。如何在tht请求中包含默认凭据?在我看到的所有解决方案中,人们都在硬编码用户名和密码
目前没有回答
相关问题 更多 >
编程相关推荐