mirror of
https://github.com/pyenv/pyenv.git
synced 2026-08-05 03:50:36 +09:00
add_cpython: refactor extra Requests logic (#3507)
--------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Ivan Pozdeev <vano@mail.mipt.ru>
This commit is contained in:
parent
bdf8d254fe
commit
8f70d418bb
@ -542,8 +542,7 @@ class OpenSSLVersionsDirectory(KeyedList[_OpenSSLVersionInfo, packaging.version.
|
|||||||
|
|
||||||
url = "https://api.github.com/repos/openssl/openssl/releases"
|
url = "https://api.github.com/repos/openssl/openssl/releases"
|
||||||
while url:
|
while url:
|
||||||
response = requests.get(url, timeout=30)
|
response = Requests.get(url)
|
||||||
response.raise_for_status()
|
|
||||||
matching = [
|
matching = [
|
||||||
release
|
release
|
||||||
for release in response.json()
|
for release in response.json()
|
||||||
@ -568,7 +567,7 @@ class OpenSSLVersionsDirectory(KeyedList[_OpenSSLVersionInfo, packaging.version.
|
|||||||
for asset in j_release['assets']
|
for asset in j_release['assets']
|
||||||
if urllib.parse.urlparse(asset['browser_download_url']).path.split('/')[-1].endswith('.sha256')
|
if urllib.parse.urlparse(asset['browser_download_url']).path.split('/')[-1].endswith('.sha256')
|
||||||
)
|
)
|
||||||
shasum_text = requests.get(shasum_url, timeout=30).text
|
shasum_text = Requests.get(shasum_url).text
|
||||||
shasum_data = jc.parse("hashsum", shasum_text, quiet=True)[0]
|
shasum_data = jc.parse("hashsum", shasum_text, quiet=True)[0]
|
||||||
package_hash, package_filename = shasum_data["hash"], shasum_data["filename"]
|
package_hash, package_filename = shasum_data["hash"], shasum_data["filename"]
|
||||||
del shasum_data, shasum_text, shasum_url
|
del shasum_data, shasum_text, shasum_url
|
||||||
@ -742,6 +741,13 @@ class Url:
|
|||||||
h.update(c)
|
h.update(c)
|
||||||
return h.hexdigest()
|
return h.hexdigest()
|
||||||
|
|
||||||
|
class Requests:
|
||||||
|
@staticmethod
|
||||||
|
def get(url: str) -> requests.Response:
|
||||||
|
response = requests.get(url, timeout=30)
|
||||||
|
response.raise_for_status()
|
||||||
|
return response
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
#sys.excepthook seems to have no effect in Github Actions
|
#sys.excepthook seems to have no effect in Github Actions
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user