Skip to content
This repository has been archived by the owner on Oct 29, 2023. It is now read-only.

Commit

Permalink
fix: Use latest API endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanChen4 committed Jul 21, 2023
1 parent a6abe10 commit d767af5
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions updaters.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Used to generate a new readme file"""
import logging
import os
import requests


Expand All @@ -14,17 +14,20 @@ def update(url: str, output: str) -> None:
:param url: The URL to read data from
:param output: The path and filename to save the output
"""
response = requests.get(url)
response = requests.get(url, timeout=60)
if 200 <= response.status_code < 300:
with open(output, "w", encoding="utf-8") as file:
file.write(response.text)
logging.info(f"Successfully saved data to {output}")
logging.info("Successfully saved data to %s", output)
else:
logging.error(f"Unable to get data from {url}")
logging.error("Unable to get data from %s", url)


def update_readme() -> None:
FileUpdater.update("https://carbos-backend-0ace626eaf33.herokuapp.com/jobs/?board=SWE_2024_SUMMER_INTERNSHIP", "./README.md")
"""
Fetches the latest version of the readme from the backend api
"""
FileUpdater.update("https://carbos-backend-0ace626eaf33.herokuapp.com/api/readme?board=SWE_2024_SUMMER_INTERNSHIP", "./README.md")


if __name__ == "__main__":
Expand Down

0 comments on commit d767af5

Please sign in to comment.