Skip to content

Commit

Permalink
remove requests dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
StardustDL committed Jan 28, 2024
1 parent a3e17bb commit b2fb291
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
7 changes: 4 additions & 3 deletions src/aexpy/preprocessing/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
from pathlib import Path
from typing import override
from urllib import parse
import urllib.request
import os
import subprocess

import requests

from ..models import Release
from .wheel import CompatibilityTag
from . import Preprocessor
Expand Down Expand Up @@ -254,7 +253,9 @@ def downloadRawWheel(
if not cacheFile.exists():
logger.info(f"Download wheel @ {url}.")
try:
content = requests.get(url, timeout=60).content
req = urllib.request.Request(url)
with urllib.request.urlopen(req, timeout=60) as res:
content = res.read()
if info.sha256:
if hashlib.sha256(content).hexdigest() != info.sha256:
raise Exception(f"Release download sha256 mismatch: {info}.")
Expand Down
14 changes: 0 additions & 14 deletions src/aexpy/preprocessing/wheel.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,12 @@
import hashlib
import platform
import re
import shutil
from typing import override
import zipfile
from dataclasses import dataclass, field
from datetime import datetime, timedelta
from email.message import Message
from email.parser import Parser
from logging import Logger
from pathlib import Path
from urllib import parse
import json

import requests
import wheel.metadata

from aexpy import getCacheDirectory, utils
from aexpy.models import Distribution

from ..models import Distribution, Release
from ..utils import elapsedTimer, ensureDirectory, logWithFile
from . import Preprocessor

FILE_ORIGIN = "https://files.pythonhosted.org/"
Expand Down

0 comments on commit b2fb291

Please sign in to comment.