Skip to content

Commit f117d78

Browse files
authored
Merge pull request #55 from my-dev-app/example
Example
2 parents 666f0da + 09f64bc commit f117d78

File tree

5 files changed

+37
-21
lines changed

5 files changed

+37
-21
lines changed

.github/workflows/test_python_flake.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Install dependencies
2323
run: |
2424
python3.11 -m pip install --upgrade pip
25-
python3.11 -m pip install -r requirements.txt --use-pep517
25+
python3.11 -m pip install -e .[dev] --use-pep517
2626
- name: Check code style
2727
run: |
2828
python3.11 -m flake8

.vscode/launch.json

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,18 @@
55
"version": "0.2.0",
66
"configurations": [
77
{
8-
"name": "Test: Start File",
8+
"name": "Start: Example",
99
"type": "python",
1010
"request": "launch",
11-
"program": "${workspaceFolder}/start.py",
11+
"program": "${workspaceFolder}/example.py",
1212
"console": "integratedTerminal",
1313
"justMyCode": true
1414
},
15-
{
16-
"name": "Test: Targeted",
17-
"type": "python",
18-
"request": "launch",
19-
"module": "pytest",
20-
"args": [
21-
"test",
22-
"tests.test_class_initialization",
23-
],
24-
"django": true,
25-
"justMyCode": true
26-
},
2715
{
2816
"name": "Test: Pytest",
2917
"type": "python",
3018
"request": "launch",
3119
"module": "pytest",
32-
33-
"env": {
34-
"PYDEVD_DISABLE_FILE_VALIDATION": "1"
35-
},
3620
"justMyCode": true
3721
},
3822
]

aproxyrelay/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,7 @@ def start(self) -> Queue:
9191

9292
loop.run_until_complete(task)
9393
self.logger.info(f'Data scraped! Took {datetime.now(UTC) - started}, enjoy!')
94-
return task.result()
94+
95+
result = task.result()
96+
loop.close()
97+
return result

example.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# -*- mode: python ; coding: utf-8 -*-
2+
from aproxyrelay import AProxyRelay
3+
4+
# Note: Duplicates will be removed by the library
5+
targets = [
6+
'https://gg.my-dev.app/api/v1/proxies/available?zone=us&anonimity=all&protocol=all&page=1&size=100&type=example',
7+
'https://gg.my-dev.app/api/v1/proxies/available?zone=de&anonimity=all&protocol=all&page=1&size=100&type=example',
8+
'https://gg.my-dev.app/api/v1/proxies/available?zone=nl&anonimity=all&protocol=all&page=1&size=100&type=example',
9+
'https://gg.my-dev.app/api/v1/proxies/available?zone=de&anonimity=all&protocol=all&page=1&size=100&type=example',
10+
'https://gg.my-dev.app/api/v1/proxies/available?zone=nl&anonimity=all&protocol=all&page=1&size=100&type=example',
11+
]
12+
13+
# Initialize proxy relay
14+
proxy_relay = AProxyRelay(
15+
targets=targets,
16+
timeout=5,
17+
test_proxy=True,
18+
test_timeout=10,
19+
zone='us',
20+
)
21+
22+
# Fetch data
23+
data = proxy_relay.start()
24+
25+
# Result Queue
26+
print(data.qsize())
27+
28+
while not data.empty():
29+
content = data.get()
30+
print(content)

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
'flake8-bugbear',
2424
'pytest',
2525
'pytest-cov',
26-
'pytest-django',
2726
'pytest-sugar',
2827
'pytest-xdist',
2928
'setuptools',

0 commit comments

Comments
 (0)