[Python] TypeError: __init__() got an unexpected keyword argument 'proxies' bs4 scraping

Discussão em 'Python' iniciado por Stack, Fevereiro 15, 2025.

  1. Stack

    Stack Membro Participativo

    #Import
    from urllib.request import ProxyDigestAuthHandler, Request, urlopen
    from bs4 import BeautifulSoup
    from bs4.element import SoupStrainer
    import requests

    #PreInit
    PROXY = {"https": "54.93.88.15:9300", "https": "165.22.81.30:38244", "https": "207.154.205.135:9999", "https": "88.198.26.145:8080", "https": "144.91.86.144:3128"}
    url = "https://www.ebay.de/b/Laptops-Notebooks/175672/bn_1618754?LH_ItemCondition=7000&mag=1&rt=nc&_dmd=1&_sop=1"
    req = Request(url, headers={"User-Agent": "Mozilla/5.0"}, proxies=PROXY)
    webpage = urlopen(req).read()

    #Init
    with requests.Session() as c:
    all_data = []
    #Web init
    soup = BeautifulSoup(webpage, "html5lib")
    #Data collection...
    print(shipping.text.strip())


    The thing above is the relevant part to the error im getting when running the script. Where do i incorporate the "proxies" value? Help appreciated

    Continue reading...

Compartilhe esta Página