added more http versions flags
Some checks failed
CI / build (push) Failing after 11s

This commit is contained in:
2024-09-15 14:48:42 +08:00
parent c00a8d1bd5
commit 4adf6a22d6
5 changed files with 141 additions and 57 deletions

View File

@@ -14,7 +14,7 @@ jobs:
- name: Create virtualenv
run: |
python -m venv .venv
.venv/bin/pip install -r requirements.txt
.venv/bin/pip install -r requirements-dev.txt
# - name: Run unit tests
# run: .venv/bin/python -m unittest discover -s tests
- name: Execute build

View File

@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "jpacrepo-uploader"
version = "0.0.2"
version = "0.0.3"
authors = [
{ name="Walter Oggioni", email="oggioni.walter@gmail.com" },
]
@@ -18,14 +18,19 @@ classifiers = [
]
dependencies = [
"oidc-client >= 0.2.6",
'certifi==2023.7.22',
'progress==1.6',
'pycurl==7.45.2',
'types-pycurl==7.45.2.5',
'typing_extensions==4.7.1',
'certifi',
'progress',
'pycurl',
'types-pycurl',
'typing_extensions',
'pwo >= 0.0.2'
]
[project.optional-dependencies]
dev = [
"build", "pip-tools", "mypy", "ipdb"
]
[project.urls]
"Homepage" = "https://github.com/woggioni/jpacrepo-uploader"
"Bug Tracker" = "https://github.com/woggioni/jpacrepo-uploader/issues"
@@ -34,7 +39,7 @@ dependencies = [
jpacrepo-uploader = "jpacrepo_uploader.uploader:main"
[tool.mypy]
python_version = "3.10"
python_version = "3.12"
disallow_untyped_defs = true
show_error_codes = true
no_implicit_optional = true

88
requirements-dev.txt Normal file
View File

@@ -0,0 +1,88 @@
#
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile --extra=dev --output-file=requirements-dev.txt pyproject.toml
#
--index-url https://gitea.woggioni.net/api/packages/woggioni/pypi/simple
--extra-index-url https://pypi.org/simple
asttokens==2.4.1
# via stack-data
build==1.2.2
# via
# jpacrepo-uploader (pyproject.toml)
# pip-tools
certifi==2024.8.30
# via jpacrepo-uploader (pyproject.toml)
click==8.1.7
# via pip-tools
decorator==5.1.1
# via
# ipdb
# ipython
executing==2.1.0
# via stack-data
ipdb==0.13.13
# via jpacrepo-uploader (pyproject.toml)
ipython==8.27.0
# via ipdb
jedi==0.19.1
# via ipython
matplotlib-inline==0.1.7
# via ipython
mypy==1.11.2
# via jpacrepo-uploader (pyproject.toml)
mypy-extensions==1.0.0
# via mypy
oidc-client==0.2.6
# via jpacrepo-uploader (pyproject.toml)
packaging==24.1
# via build
parso==0.8.4
# via jedi
pexpect==4.9.0
# via ipython
pip-tools==7.4.1
# via jpacrepo-uploader (pyproject.toml)
progress==1.6
# via jpacrepo-uploader (pyproject.toml)
prompt-toolkit==3.0.47
# via ipython
ptyprocess==0.7.0
# via pexpect
pure-eval==0.2.3
# via stack-data
pwo==0.0.3
# via jpacrepo-uploader (pyproject.toml)
pycurl==7.45.3
# via jpacrepo-uploader (pyproject.toml)
pygments==2.18.0
# via ipython
pyproject-hooks==1.1.0
# via
# build
# pip-tools
six==1.16.0
# via asttokens
stack-data==0.6.3
# via ipython
traitlets==5.14.3
# via
# ipython
# matplotlib-inline
types-pycurl==7.45.3.20240421
# via jpacrepo-uploader (pyproject.toml)
typing-extensions==4.7.1
# via
# jpacrepo-uploader (pyproject.toml)
# mypy
# pwo
wcwidth==0.2.13
# via prompt-toolkit
wheel==0.44.0
# via pip-tools
# The following packages are considered to be unsafe in a requirements file:
# pip
# setuptools

View File

@@ -1,44 +1,25 @@
argcomplete==3.4.0
build==1.2.1
#
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile --output-file=requirements.txt pyproject.toml
#
--index-url https://gitea.woggioni.net/api/packages/woggioni/pypi/simple
--extra-index-url https://pypi.org/simple
certifi==2023.7.22
cffi==1.16.0
charset-normalizer==3.3.2
click==8.1.7
cryptography==42.0.8
docutils==0.21.2
idna==3.7
importlib_metadata==7.2.0
jaraco.classes==3.4.0
jaraco.context==5.3.0
jaraco.functools==4.0.1
jeepney==0.8.0
keyring==25.2.1
markdown-it-py==3.0.0
mdurl==0.1.2
more-itertools==10.3.0
mypy==1.10.0
mypy-extensions==1.0.0
nh3==0.2.17
# via jpacrepo-uploader (pyproject.toml)
oidc-client==0.2.6
packaging==24.1
pipx==1.6.0
pkginfo==1.11.1
platformdirs==4.2.2
# via jpacrepo-uploader (pyproject.toml)
progress==1.6
# via jpacrepo-uploader (pyproject.toml)
pwo==0.0.2
pycparser==2.22
# via jpacrepo-uploader (pyproject.toml)
pycurl==7.45.2
Pygments==2.18.0
pyproject_hooks==1.1.0
readme_renderer==43.0
requests==2.32.3
requests-toolbelt==1.0.0
rfc3986==2.0.0
rich==13.7.1
SecretStorage==3.3.3
twine==5.1.0
# via jpacrepo-uploader (pyproject.toml)
types-pycurl==7.45.2.5
typing_extensions==4.7.1
urllib3==2.2.2
userpath==1.9.2
zipp==3.19.2
# via jpacrepo-uploader (pyproject.toml)
typing-extensions==4.7.1
# via
# jpacrepo-uploader (pyproject.toml)
# pwo

View File

@@ -128,13 +128,11 @@ class JpacrepoClient:
cond: Condition
thread: Optional[Thread]
verbose: bool
http2: bool
http3: bool
http_version : int
def __init__(self, config: Config,
verbose: bool = False,
http2: bool = False,
http3: bool = False
**kwargs,
):
self.config: Config = config
self.token: Optional[TokenResponse] = None
@@ -143,8 +141,16 @@ class JpacrepoClient:
self.cond = Condition()
self.thread: Optional[Thread] = None
self.verbose: bool = verbose
self.http2: bool = http2
self.http3: bool = http3
if kwargs.get('http1.0'):
self.http_version = pycurl.CURL_HTTP_VERSION_1_0
elif kwargs.get('http1.1'):
self.http_version = pycurl.CURL_HTTP_VERSION_1_1
elif kwargs.get('http2'):
self.http_version = pycurl.CURL_HTTP_VERSION_2
elif kwargs.get('http3'):
self.http_version = pycurl.CURL_HTTP_VERSION_3
else:
self.http_version = pycurl.CURL_HTTP_VERSION_NONE
def __enter__(self) -> Self:
return self
@@ -311,11 +317,7 @@ class JpacrepoClient:
curl.setopt(pycurl.NOPROGRESS, False)
curl.setopt(pycurl.VERBOSE, self.verbose)
curl.setopt(pycurl.CAINFO, certifi.where())
if self.http2:
curl.setopt(pycurl.HTTP_VERSION, pycurl.CURL_HTTP_VERSION_2)
if self.http3:
curl.setopt(pycurl.HTTP_VERSION, pycurl.CURL_HTTP_VERSION_3)
curl.setopt(pycurl.HTTP_VERSION, self.http_version)
with open(str(file_path), 'rb') as file:
curl.setopt(pycurl.READDATA, file)
curl.perform()
@@ -333,6 +335,14 @@ def main() -> None:
default=False,
action='store_true',
help="Enable verbose output")
parser.add_argument('-0', '--http1.0',
default=True,
action='store_true',
help="Force HTTP/1.1 protocol")
parser.add_argument('-1', '--http1.1',
default=True,
action='store_true',
help="Force HTTP/1.1 protocol")
parser.add_argument('-2', '--http2',
default=True,
action='store_true',