在 python 3 中使用弹出警报验证抓取网页

Scraping a webpage with a pop up alert auth in python 3

我一直在尝试抓取这个web page with python 3 where the login is like a pop up alert that you can see it here, I tried using basic auth (https://(username):(password)@(url)), mechanize and ntlm-auth但没有成功,或者我做错了,我需要一种方法,我希望有人能帮我解决这个问题...

使用 ntlm-auth 我没有得到任何错误,但响应就像未经身份验证的页面,这是我的代码的一部分:

from requests_ntlm import HttpNtlmAuth
import requests as rq

username = 'username'
password = 'password'    

url_prod = 'http://www2.deltron.com.pe/modulos/productos/items/producto.php?item_number=NBHP2B125LA'

sess = rq.Session()
sess.auth = HttpNtlmAuth(username, password)
resp = sess.get(url_prod)

print(resp, resp.text)

我在另一个站点上遇到了相同的识别弹出窗口的相同问题,并通过请求的基本身份验证解决了这个问题

from requests.auth import HTTPBasicAuth

requests.get('https://api.github.com/user', auth=HTTPBasicAuth('user', 'pass'))

https://docs.python-requests.org/en/latest/user/authentication/