Skip to content

Commit

Permalink
Added shortid to webhook message
Browse files Browse the repository at this point in the history
  • Loading branch information
bojo509 committed Dec 19, 2024
1 parent 53ad818 commit 73007a1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion parfium.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def fetch_urls(endpoint):
response.raise_for_status()
perfumes = response.json()

urls = [{"link": perfume["link"], "title": perfume["title"]} for perfume in perfumes]
urls = [{"link": perfume["link"], "title": perfume["title"], "shortid": perfume["shortid"]} for perfume in perfumes]
return urls

except requests.exceptions.RequestException as e:
Expand Down Expand Up @@ -97,6 +97,7 @@ def check_price_pbg(driver, urls):
if availability_text:
message += f" {availability_text}"

message += f" - {url}{item['shortid']}"
logging.info(f"Price found: {price_to_pay}")
send_discord_message(f"Price of {message}")

Expand Down Expand Up @@ -136,6 +137,11 @@ def main():
try:
logging.info("Starting the script")
endpoint = "https://perfumes.jobify.one"
shortIdResponse = requests.get("https://perfumes.jobify.one/shortidendpoint")
shortIdResponse.raise_for_status()
shortIdData = shortIdResponse.json()
url = shortIdData["url"]

healthcheck = requests.get(endpoint + '/health-check')
while healthcheck.status_code != 200:
logging.error("Trying to wake the server up")
Expand Down

0 comments on commit 73007a1

Please sign in to comment.