Skip to content

Commit

Permalink
try use http native python client
Browse files Browse the repository at this point in the history
  • Loading branch information
carlos-rian committed Oct 27, 2023
1 parent dcf4daa commit 61161c5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
10 changes: 6 additions & 4 deletions .github/prod.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import http.client as http
import json
import os
import urllib

import toml

Expand All @@ -10,12 +10,14 @@

# convert get_version to use native python libs
def get_version():
uri = "https://pypi.org/pypi/pysqlx-core/json"
host = "pypi.org"
for _ in range(3):
resp = urllib.request.urlopen(uri)
conn = http.HTTPSConnection(host, timeout=30)
conn.request("GET", "/pypi/pysqlx-core/json")
resp = conn.getresponse()
if resp.status == 200:
break
data: dict = json.loads(resp.read())
data: dict = json.load(resp)
return data["info"]["version"]


Expand Down
10 changes: 6 additions & 4 deletions .github/release.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import http.client as http
import json
import urllib

import toml

Expand All @@ -8,12 +8,14 @@


def get_version():
uri = "https://pypi.org/pypi/pysqlx-core/json"
host = "pypi.org"
for _ in range(3):
resp = urllib.request.urlopen(uri)
conn = http.HTTPSConnection(host, timeout=30)
conn.request("GET", "/pypi/pysqlx-core/json")
resp = conn.getresponse()
if resp.status == 200:
break
data: dict = json.loads(resp.read())
data: dict = json.load(resp)

releases = data["releases"]
versions = sorted(
Expand Down

0 comments on commit 61161c5

Please sign in to comment.