Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
Empty file added Icon
Empty file.
Binary file added webscraper/.DS_Store
Binary file not shown.
8 changes: 8 additions & 0 deletions webscraper/api/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ def scrape_books():
results = scraper.get_scraped_data(paths)
return jsonify(results)

@app.route('/sample-product', methods=['GET'])
def get_sample_product():
sample_product = {
"product_name": "Sample Book",
"price": 19.99
}
return jsonify(sample_product)

if __name__ == '__main__':
app.run(debug=True)

8 changes: 5 additions & 3 deletions webscraper/src/Cheaper_Scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
from functools import lru_cache


class CheaperScraper(BaseScraper):
def __init__(self, base_url:str, user_agent: str= "CheaperBot/0.1", delay: float=2.0) -> None:



class CheaperScraper(BaseScraper, ScraperAPIInterface):
def __init__(self, base_url: str = "", user_agent: str = "CheaperBot/0.1", delay: float = 2.0) -> None:
"""Initialize the scraper with base parameters.

Args:
Expand Down Expand Up @@ -101,7 +104,6 @@ def scrape(self, paths: List[str]) -> Dict[str, List[str]]:
if html:
results[path] = self.parse(html)
return results


def get_scraped_data(self, paths: List[str]) -> Dict[str, List[str]]:
return self.scrape(paths)
Binary file modified webscraper/src/__pycache__/Cheaper_Scraper.cpython-311.pyc
Binary file not shown.
Binary file not shown.