Skip to content

Commit

Permalink
Move seatemperature.info to 'POST'
Browse files Browse the repository at this point in the history
'GET' omits the text in the 'Aktuelle Wassertemperatur in "..."'

Instead it displays a form with 'action=POST'

We'll be using this instead then

Note: this doesn't happen locally
  • Loading branch information
torbencarstens committed Dec 7, 2023
1 parent 62acdac commit 6e9ef07
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lake_scrapers/scrapers/seatemperatureinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import re
from datetime import datetime

import httpx

from lake_scrapers import convert_timestamp, LakeTemperatureItem
from lake_scrapers.scraper import Scraper

Expand Down Expand Up @@ -49,6 +51,11 @@ class SeaTemperatureInfoScraper(Scraper):
"italy/sorrento-water-temperature.html",
]

def request(self, path: str) -> httpx.Response:
url = "/".join([self.base_url.rstrip("/"), path.lstrip("/")])

return httpx.post(url, headers=self.headers, timeout=15, follow_redirects=True)

def parse(self, response, **kwargs):
path = response.request.url.path.lstrip("/")
regex = self.data[path]["regex"]
Expand Down

0 comments on commit 6e9ef07

Please sign in to comment.