Overview
This prompt guides developers in integrating the 404deals API with a scraper, ensuring efficient deal filtering and logging. Programmers and coding professionals will benefit by enhancing their skills in API integration and error handling.
Prompt Overview
Purpose: This integration aims to enhance deal notifications by sending qualifying deals to the 404deals API.
Audience: The target audience includes developers working on the SCRAPERNAME scraper and those interested in deal notifications.
Distinctive Feature: The implementation includes filtering based on a discount threshold and optional field checks for enhanced data accuracy.
Outcome: Successful integration will improve deal visibility and ensure only relevant deals are sent to users.
Quick Specs
- Media: Text
- Use case: Generation
- Industry: Cryptocurrency & Blockchain, Development Tools & DevOps
- Techniques: Function Calling / Tool Use, Role/Persona Prompting, Structured Output
- Models: Claude 3.5 Sonnet, Gemini 2.0 Flash, GPT-4o, Llama 3.1 70B
- Estimated time: 5-10 minutes
- Skill level: Beginner
Variables to Fill
- ["image_url"] – "image Url"
Example Variables Block
- ["image_url"]: Example "image Url"
The Prompt
Integrate the 404deals API with the SCRAPERNAME scraper using the implementation in `404deals_api.py` as a reference. Ensure the following requirements are met:
1. Filter Deals:
– Only send deals to 404deals that meet the criteria for Discord notifications based on the `DISCOUNT_THRESHOLD` defined in `config.py`.
2. Add Configuration:
– Copy the 404deals API endpoint and token to the scraper’s `config.py` file.
3. Function Implementation:
– Implement the `send_deal_to_404deals` function directly in the `notifier.py` file without creating external dependencies.
### Function Requirements:
– The function must send the following required fields to the API:
– `title`
– `url`
– `old_price`
– `new_price`
– `discount_percentage`
– `site`
– For optional fields (`EAN`, `image_url`, `availability`):
– Check the Discord embed creation code under the `_create_embed` method to identify which fields are utilized in the product data.
– Include those in the API call if present.
### Field Checks:
– Examine the Discord embed code to determine the availability of:
– `EAN`
– `image_url`
– `availability`
– For example, if the embed code contains something like `”thumbnail”: [“url”: product_data[“image_url”]]`, you must include `image_url` in the API call.
### Logging and Error Handling:
– Follow the existing error handling and logging patterns used throughout the scraper.
### Integration Point:
– Add the 404deals API call immediately after sending the Discord notification, specifically for deals that meet the discount threshold.
### Formatting the Site Field:
– Use the website’s name as the `site` field in `deal_data`, formatted to lower case with `.nl` appended (e.g., if the website’s name is Google, use `google.nl`).
### Proxies Configuration:
– Update the scraper to read its proxies from the parent directory instead of its current folder.
– The proxies file is named `proxies.txt` and should be loaded from one level up from the scraper’s location.
Screenshot Examples
How to Use This Prompt
- [DISCOUNT_THRESHOLD]: Minimum discount for notifications.
- [API_ENDPOINT]: URL for 404deals API access.
- [API_TOKEN]: Authentication token for API requests.
- [EAN]: Optional field for product identification.
- [image_url]: URL for product image display.
- [availability]: Product availability status information.
- [site]: Formatted website name for deals.
- [proxies]: File path for proxy configuration.
Tips for Best Results
- Filter Deals: Ensure only deals meeting the DISCOUNT_THRESHOLD criteria are sent to 404deals.
- Add Configuration: Copy the API endpoint and token to the scraper’s config.py file for easy access.
- Function Implementation: Implement the send_deal_to_404deals function in notifier.py without external dependencies.
- Logging and Error Handling: Follow existing patterns for error handling and logging when sending data to the API.
FAQ
- What is the purpose of the 404deals API integration?
To send filtered deals that meet Discord notification criteria to the 404deals platform. - Where should the API endpoint and token be stored?
In the scraper's `config.py` file for easy access and configuration. - What fields are required for the API call?
The required fields are title, url, old_price, new_price, discount_percentage, and site. - How should the site field be formatted?
The site field should be the website's name in lower case with '.nl' appended.
Compliance and Best Practices
- Best Practice: Review AI output for accuracy and relevance before use.
- Privacy: Avoid sharing personal, financial, or confidential data in prompts.
- Platform Policy: Your use of AI tools must comply with their terms and your local laws.
Revision History
- Version 1.0 (February 2026): Initial release.


