omkarcloud / botasaurus

The All in One Framework to build Awesome Scrapers.
https://www.omkar.cloud/botasaurus/
MIT License
1.14k stars 103 forks source link

error with request #129

Closed leuriniale96 closed 1 month ago

leuriniale96 commented 1 month ago

I have installed the latest version 4.0.34

When I run this piece of code copied directly from the documentation:

from botasaurus.request import request, Request
from botasaurus.soupify import soupify

@request
def scrape_heading_task(request: Request, data):
    # Visit the Omkar Cloud website
    response = request.get("https://www.omkar.cloud/")

    # Create a BeautifulSoup object    
    soup = soupify(response)

    # Retrieve the heading element's text
    heading = soup.find('h1').get_text()

    # Save the data as a JSON file in output/scrape_heading_task.json
    return {
        "heading": heading
    }     
# Initiate the web scraping task
scrape_heading_task()

I get the following error:

TypeError: Request.__init__() accepts 1 to 2 positional arguments, but was given 3

I fixed changing the init method of Request class in request_class.py:

def __init__(self, proxy=None, user_agent=None):
    self._proxy = proxy
Chetan11-dev commented 1 month ago

please run python -m pip install bota botasaurus botasaurus-api botasaurus-requests botasaurus-driver bota botasaurus-proxy-authentication botasaurus-server --upgrade to fix this