Skip to content

Conversation

@m4dm4rtig4n
Copy link
Contributor

Summary

  • Implement actual HTML parsing for Ekwateur pricing page using BeautifulSoup instead of returning empty stub
  • Update fallback prices to December 2025 with current Ekwateur rates
  • Remove obsolete offer types (Prix variable, VE) no longer available on website

Test plan

  • Verify scraper attempts HTML parsing before fallback
  • Confirm fallback prices match Ekwateur website (Base: 0.1606€/kWh, HC/HP: 0.17914€/0.14026€)
  • Test admin offers page preview/refresh with Ekwateur provider

🤖 Generated with Claude Code

…25 prices

Replace stub _parse_html with actual BeautifulSoup-based HTML parsing to extract pricing from Ekwateur's website tables instead of always falling back to manual data. Update fallback prices to December 2025 and remove obsolete offers (Prix variable, VE) no longer available on their website.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings December 4, 2025 23:28
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements actual HTML parsing for the Ekwateur electricity pricing scraper and updates fallback prices to December 2025 rates. The implementation replaces the stub _parse_html method with BeautifulSoup-based table parsing logic.

Key Changes:

  • Added HTML parsing functionality using BeautifulSoup and regex to extract kWh and subscription prices from pricing tables
  • Updated fallback prices from November to December 2025 with current market rates
  • Removed discontinued offer types (variable pricing and electric vehicle special offers)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +31 to +32
6: {"subscription": 15.84, "hp": 0.17914, "hc": 0.1426},
9: {"subscription": 20.48, "hp": 0.17914, "hc": 0.1426},
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent HC (heures creuses) prices for 6 kVA and 9 kVA power levels. Line 30 shows hc: 0.14026 for 3 kVA, but lines 31-32 show hc: 0.1426 for 6 and 9 kVA. This appears to be a typo - the HC price should likely be consistent across power levels or the values should be 0.14026 instead of 0.1426.

Suggested change
6: {"subscription": 15.84, "hp": 0.17914, "hc": 0.1426},
9: {"subscription": 20.48, "hp": 0.17914, "hc": 0.1426},
6: {"subscription": 15.84, "hp": 0.17914, "hc": 0.14026},
9: {"subscription": 20.48, "hp": 0.17914, "hc": 0.14026},

Copilot uses AI. Check for mistakes.
try:
price = float(price_match.group(1))
# kWh prices are typically between 0.10 and 0.50
if 0.05 < price < 0.60:
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Magic numbers 0.05 and 0.60 used for kWh price validation lack explanation. Consider extracting these as named constants (e.g., MIN_KWH_PRICE = 0.05, MAX_KWH_PRICE = 0.60) with documentation explaining the acceptable price range.

Copilot uses AI. Check for mistakes.
try:
price = float(price_match.group(1))
# Subscription prices are typically between 10 and 50 €/month
if 5.0 < price < 60.0:
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Magic numbers 5.0 and 60.0 used for subscription price validation lack explanation. Consider extracting these as named constants (e.g., MIN_SUBSCRIPTION_PRICE = 5.0, MAX_SUBSCRIPTION_PRICE = 60.0) with documentation explaining the acceptable price range.

Copilot uses AI. Check for mistakes.
Comment on lines +194 to +203
if len(prices) >= 9:
data["base_3"] = prices[0]
data["base_6"] = prices[1]
data["base_9"] = prices[2]
data["hp_3"] = prices[3]
data["hp_6"] = prices[4]
data["hp_9"] = prices[5]
data["hc_3"] = prices[6]
data["hc_6"] = prices[7]
data["hc_9"] = prices[8]
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hardcoded index-based price assignments assume a fixed order (Base 3/6/9, HP 3/6/9, HC 3/6/9) without verification. This is brittle and could silently assign wrong prices if the website's table structure changes. Consider adding validation comments or assertions to document the expected structure, or implement more robust parsing that identifies which column corresponds to which power level.

Copilot uses AI. Check for mistakes.
…ucture

Update table detection logic to work with Ekwateur's actual HTML structure:
- Look for "heures creuses" instead of "€/kWh" or "kWh" in table detection
- Handle combined "heures pleines / heures creuses" header pattern
- Add debug logging for parsed prices

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@m4dm4rtig4n m4dm4rtig4n merged commit 87c9c1d into main Dec 4, 2025
5 checks passed
@m4dm4rtig4n m4dm4rtig4n deleted the ekwateur-fallback-fix branch December 18, 2025 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants