【问题标题】:Running Python script on Visual Studio local website在 Visual Studio 本地网站上运行 Python 脚本
【发布时间】:2020-08-04 19:20:49
【问题描述】:

您好,我有一个脚本,我在我的组织内部网络上运行,但它应该在 1 号运行,但它没有,所以我在本地数据库上备份了数据,以便我可以运行脚本获得正确的数据。我更改了 url,使其与我的本地站点对齐,但它无法正常工作,因为我收到错误

HTTPSConnectionPool(host='localhost', port=44345): Max retries exceeded with url: /logon.aspx (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7fc26acb86a0>: Failed to establish a new connection: [Errno 111] Connection refused',)

这是我设置脚本以访问 url 的方式

URL = "https://localhost:44345/logon.aspx"
headers = {"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36"}
username="script"
password="password"
s = Session()
s.verify = False

s.headers.update(headers)
r = s.get(URL)

为什么我的连接被拒绝?我可以通过 Internet 浏览器浏览该网站,但为什么我的连接被拒绝?

【问题讨论】:

    标签: python linux bash visual-studio https


    【解决方案1】:

    由于您在 localhost 上运行,请尝试使用 http 协议而不是 https。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-08
    • 1970-01-01
    相关资源
    最近更新 更多