Skip to content

Commit 501c53d

Browse files
author
Two Dev
committed
chore: CI
1 parent 8196011 commit 501c53d

File tree

7 files changed

+35
-16
lines changed

7 files changed

+35
-16
lines changed

.github/workflows/ci.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ jobs:
1111
build:
1212
runs-on: ubuntu-latest
1313
strategy:
14-
max-parallel: 4
14+
fail-fast: false
15+
max-parallel: 3
1516
matrix:
1617
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
1718
steps:
@@ -23,16 +24,15 @@ jobs:
2324

2425
- name: Install Dependencies
2526
run: |
26-
python -m pip install --upgrade pip
27-
pip install -r requirements-dev.txt
27+
make init
2828
2929
- name: Lint
3030
run: |
3131
make lint
3232
3333
- name: Tests
3434
run: |
35-
python -m pytest tests
35+
make pytest
3636
3737
deploy:
3838
needs: build

Makefile

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.PHONY: docs
22
init:
3+
python -m pip install --upgrade pip
34
python -m pip install -r requirements-dev.txt
45

56
test:
@@ -14,6 +15,9 @@ lint:
1415
python -m isort tls_requests
1516
python -m flake8 tls_requests
1617

18+
pytest:
19+
python -m pytest tests
20+
1721
coverage:
1822
python -m pytest --cov-config .coveragerc --verbose --cov-report term --cov-report xml --cov=tls_requests tests
1923

@@ -25,11 +29,11 @@ publish-test-pypi:
2529
python -m pip install 'twine>=6.0.1'
2630
python setup.py sdist bdist_wheel
2731
twine upload --repository testpypi dist/*
28-
rm -rf build dist .egg *.egg-info
32+
rm -rf build dist .egg wrapper_tls_requests.egg-info
2933

3034
publish-pypi:
3135
python -m pip install -r requirements-dev.txt
3236
python -m pip install 'twine>=6.0.1'
3337
python setup.py sdist bdist_wheel
3438
twine upload dist/*
35-
rm -rf build dist .egg *.egg-info
39+
rm -rf build dist .egg wrapper_tls_requests.egg-info

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# TLS REQUESTS
2-
**A powerful and lightweight Python library for making secure and reliable HTTP/TLS Fingerprint requests.**
1+
# TLS Requests
2+
TLS Requests is a powerful Python library for secure HTTP requests, offering browser-like TLS fingerprinting, anti-bot bypassing, and high performance.
33

44
* * *
55

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Base
22
chardet~=5.2.0
3-
requests>=2.28.0
3+
requests~=2.32.3
44
tqdm~=4.67.1
55
idna~=3.10

tests/conftest.py

+6
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1+
import tls_requests
2+
13
pytest_plugins = ['pytest_httpserver', 'pytest_asyncio']
4+
5+
6+
def pytest_configure(config):
7+
tls_requests.TLSLibrary.load()

tls_requests/models/libraries.py

+15-6
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,13 @@
1515

1616
BIN_DIR = os.path.join(Path(__file__).resolve(strict=True).parent.parent / "bin")
1717
GITHUB_API_URL = "https://api.github.com/repos/bogdanfinn/tls-client/releases"
18+
OS_PLATFORM = platform
19+
OS_MACHINE = machine()
20+
if OS_PLATFORM == "linux" and OS_MACHINE == "x86_64":
21+
OS_MACHINE = "amd64"
22+
1823
PATTERN_RE = re.compile(
19-
r"xgo[a-zA-Z0-9.-]+%s-%s\.(so|dll|dylib)" % (platform, machine()), re.I
24+
r"[a-zA-Z0-9.-]+%s-%s\.(so|dll|dylib)" % (OS_PLATFORM, OS_MACHINE), re.I
2025
)
2126

2227

@@ -58,6 +63,7 @@ def from_kwargs(cls, **kwargs):
5863
class TLSLibrary:
5964
@classmethod
6065
def fetch_api(cls, version: str = None, retries: int = 3):
66+
6167
for _ in range(retries):
6268
try:
6369
response = requests.get(GITHUB_API_URL)
@@ -70,14 +76,16 @@ def fetch_api(cls, version: str = None, retries: int = 3):
7076
asset
7177
for release in releases
7278
for asset in release.assets
73-
if "xgo" in str(asset.browser_download_url)
79+
if PATTERN_RE.search(asset.browser_download_url)
7480
]
7581
if version is not None:
7682
for asset in assets:
7783
if str(version) == asset.name:
78-
return [asset.browser_download_url]
84+
yield asset.browser_download_url
85+
86+
for asset in assets:
87+
yield asset.browser_download_url
7988

80-
return [asset.browser_download_url for asset in assets]
8189
except Exception as e:
8290
print("Unable to fetch GitHub API: %s" % e)
8391

@@ -96,11 +104,12 @@ def find_all(cls) -> list[str]:
96104
@classmethod
97105
def download(cls, version: str = None) -> str:
98106
try:
107+
print("System Info - Platform: %s, Machine: %s." % (OS_PLATFORM, OS_MACHINE))
99108
download_url = None
100109
for download_url in cls.fetch_api(version):
101-
if PATTERN_RE.search(download_url):
102-
break
110+
break
103111

112+
print("Library Download URL: %s" % download_url)
104113
if download_url:
105114
destination = os.path.join(BIN_DIR, download_url.split("/")[-1])
106115
with requests.get(download_url, stream=True) as response:

tox.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py{39,310,311,312,313}-{default, use_chardet_on_py3}
2+
envlist = py{39,310,311,312,313}-default
33

44
[testenv]
55
deps = -r requirements-dev.txt

0 commit comments

Comments
 (0)