Refactor HTTP common code (#207)
- move to common/http.py, - make fetch_url return a Response.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import json
|
||||
from common import http
|
||||
from common import dates
|
||||
from common import endoflife
|
||||
|
||||
@@ -7,8 +7,8 @@ PHP_MAJOR_VERSIONS = [4, 5, 7, 8]
|
||||
|
||||
def fetch_versions(major_version):
|
||||
url = f"https://www.php.net/releases/index.php?json&max=-1&version={major_version}"
|
||||
response = endoflife.fetch_url(url)
|
||||
data = json.loads(response)
|
||||
response = http.fetch_url(url)
|
||||
data = response.json()
|
||||
for v in data:
|
||||
data[v] = dates.parse_date(data[v]["date"]).strftime("%Y-%m-%d")
|
||||
print(f"{v}: {data[v]}")
|
||||
|
||||
Reference in New Issue
Block a user