DE-2410-A / web-scraping-vedi-hamza

de-2410-a-challenges-web-scraping-web-scraping-activity created by GitHub Classroom
0 stars 1 forks source link

As a USER I want to be able to...do something So that I can...achieve a specific goal or objective #1

Open mkilo88 opened 3 days ago

mkilo88 commented 3 days ago

Tasks should include things like: Create and test a function to make a request to the website Create and test a function to parse the response Create and test a function to extract the data Create and test a function to save the data for processing

mkilo88 commented 3 days ago

Re-opened

mkilo88 commented 3 days ago

Markdown

New Functionality: Fetch Book Data from website.

Problem Definition

As a data engineer, I need a function that can send an HTTP GET request to a book website and store the response. This function will be a fundamental part of our book data retrieval application, allowing us to fetch the current data on how many books are available in each category and the average price point of book in each category.

Functional Requirements

  1. The function should accept a URL as an input parameter.
  2. The function should send an HTTP GET request to the book site using the requests library.
  3. The function should handle the response:
    • If the response status code is 200, the function should return the book data in JSON format.
    • If the response status code is not 200, the function should return an error message indicating the status code and that the request was unsuccessful.
  4. The function should catch any exceptions that occur during the request and return an appropriate error message.

Testing Requirements

  1. Successful Request:

    • The function should receive a URL and make a GET request to the website.
    • The function should return the data in JSON format if the response status code is 200.
  2. Unsuccessful Request:

    • The function should return an error message if the response status code is not 200.
    • The error message should include the status code and indicate that the request was unsuccessful.
  3. Exception Handling:

    • The function should catch any exceptions that occur during the request.
    • The function should return an error message indicating that an exception occurred.
mkilo88 commented 3 days ago

Definition of Done