Skip to content

Commit 3d891f4

Browse files
committed
update readme
1 parent 2ee6392 commit 3d891f4

22 files changed

+200
-125
lines changed

README.rst

Lines changed: 29 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -17,43 +17,10 @@ You can donate here -> https://www.patreon.com/join/2313433
1717

1818
Thank you :)
1919

20-
How to build?
21-
*************
22-
23-
1 Clone this repository
24-
25-
.. code-block:: bash
26-
27-
git clone https://github.com/DevAlone/proxy_py.git
28-
29-
2 Install requirements
30-
31-
.. code-block:: bash
32-
33-
cd proxy_py
34-
pip3 install -r requirements.txt
35-
36-
3 Create settings file
37-
38-
.. code-block:: bash
39-
40-
cp config_examples/settings.py proxy_py/settings.py
41-
42-
4 Install postgresql and change database configuration in settings.py file
43-
44-
5 (Optional) Configure alembic
45-
46-
6 Run your application
47-
48-
.. code-block:: bash
49-
python3 main.py
50-
51-
7 Enjoy!
52-
53-
I'm too lazy. Can I just use it?
54-
********************************
20+
How to install?
21+
***************
5522

56-
Yep, here is a prepared docker image
23+
There is a prepared docker image.
5724

5825
1 Install docker. If you're using ubuntu:
5926

@@ -218,7 +185,18 @@ Example using aiohttp library:
218185
How to interact with API?
219186
*************************
220187

221-
Read more about API here -> https://github.com/DevAlone/proxy_py/tree/master/docs/API.md
188+
Read more about API here -> https://proxy-py.readthedocs.io/en/latest/api_overview.html
189+
190+
What about WEB interface?
191+
*************************
192+
193+
There is lib.ru inspired web interface which consists of these pages(with slash at the end):
194+
195+
- http://localhost:55555/i/get/proxy/
196+
- http://localhost:55555/i/get/proxy_count_item/
197+
- http://localhost:55555/i/get/number_of_proxies_to_process/
198+
- http://localhost:55555/i/get/number_of_proxies_to_process/
199+
- http://localhost:55555/i/get/collector_state/
222200

223201
How to contribute?
224202
******************
@@ -242,78 +220,35 @@ anything, just run
242220
243221
inside virtual environment in proxy_py project directory.
244222

245-
How to deploy on production using supervisor, nginx and postgresql in 9 steps?
246-
******************************************************************************
247-
248-
1 Install supervisor, nginx and postgresql
249-
250-
.. code-block:: bash
251-
252-
root@server:~$ apt install supervisor nginx postgresql
253-
254-
2 Clone this repository
255-
256-
.. code-block:: bash
257-
258-
user@server:~/$ git clone https://github.com/DevAlone/proxy_py.git
223+
How to build from scratch?
224+
**************************
259225

260-
3 Create virtual environment and install requirements on it
261-
262-
.. code-block:: bash
263-
264-
user@server:~/proxy_py$ python3 -m venv env
265-
user@server:~/proxy_py$ pip3 install -r requirements.txt
266-
267-
4 Copy settings.py example:
226+
1 Clone this repository
268227

269228
.. code-block:: bash
270229
271-
proxy_py@server:~/proxy_py$ cp config_examples/settings.py ./
230+
git clone https://github.com/DevAlone/proxy_py.git
272231
273-
5 create unprivileged user in postgresql database
274-
and change database authentication data in settings.py
232+
2 Install requirements
275233

276234
.. code-block:: bash
277235
278-
proxy_py@server:~/proxy_py$ vim proxy_py/settings.py
279-
280-
.. code-block:: python
281-
282-
DATABASE_CONNECTION_KWARGS = {
283-
'database': 'YOUR_POSTGRES_DATABASE',
284-
'user': 'YOUR_POSTGRES_USER',
285-
'password': 'YOUR_POSTGRES_PASSWORD',
286-
# number of simultaneous connections
287-
# 'max_connections': 20,
288-
}
236+
cd proxy_py
237+
pip3 install -r requirements.txt
289238
290-
6 Copy supervisor config example and change it for your case
239+
3 Create settings file
291240

292241
.. code-block:: bash
293242
294-
cp /home/proxy_py/proxy_py/config_examples/proxy_py.supervisor.conf /etc/supervisor/conf.d/proxy_py.conf
295-
vim /etc/supervisor/conf.d/proxy_py.conf
296-
297-
7 Copy nginx config example, enable it and change if you need
243+
cp config_examples/settings.py proxy_py/settings.py
298244
299-
.. code-block:: bash
245+
4 Install postgresql and change database configuration in settings.py file
300246

301-
cp /home/proxy_py/proxy_py/config_examples/proxy_py.nginx.conf /etc/nginx/sites-available/proxy_py
302-
ln -s /etc/nginx/sites-available/proxy_py /etc/nginx/sites-enabled/
303-
vim /etc/nginx/sites-available/proxy_py
247+
5 (Optional) Configure alembic
304248

305-
8 Restart supervisor and Nginx
249+
6 Run your application
306250

307251
.. code-block:: bash
252+
python3 main.py
308253
309-
supervisorctl reread
310-
supervisorctl update
311-
/etc/init.d/nginx configtest
312-
/etc/init.d/nginx restart
313-
314-
9 Enjoy using it on your server!
315-
316-
What is it depend on?
317-
*********************
318-
319-
See *requirements.txt*
254+
7 Enjoy!

docs/source/api_v1_overview.md renamed to docs/source/api_overview.md

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# proxy_py API
1+
# proxy_py API v1
22

33
proxy_py expects HTTP POST requests with JSON as a body, so you need
44
to add header `Content-Type: application/json` and send correct
@@ -7,16 +7,16 @@ JSON document.
77
Example of correct request:
88
```json
99
{
10-
"model": "proxy",
11-
"method": "get"
10+
"method": "get",
11+
"model": "proxy"
1212
}
1313
```
1414

1515
Response is also HTTP with JSON and status code depending on whether
1616
error happened or not.
1717

1818
* 200 if there wasn't error
19-
* 400 if you sent bad request
19+
* 400 if you sent a bad request
2020
* 500 if there was an error during execution your request or in some
2121
other cases
2222

@@ -35,32 +35,33 @@ Now it's only supported to work with `proxy` model.
3535

3636
### get method
3737

38-
`get` method supports following keys:
39-
* `order_by` (string) - specifies ordering fields as comma separated
38+
`get` method supports the following keys:
39+
* `order_by` (string) - specifies ordering fields as comma separated ("response_time" if not provided)
4040
value.
4141

42-
Examples:
42+
Explanation:
4343

4444
`"uptime"` just sorts proxies by uptime field ascending.
4545

4646
Note: `uptime` is the timestamp from which proxy is working,
4747
NOT proxy's working time
4848

49-
To sort descending use `-` before field name.
49+
To sort descending use `-`(minus) before the field name.
5050

5151
`"-response_time"` returns proxies with maximum response_time first
5252
(in microseconds)
5353

54-
It's possible to sort using multiple fields
54+
It's also possible to sort using multiple fields
5555

5656
`"number_of_bad_checks, response_time"` returns proxies with minimum
5757
`number_of_bad_checks` first, if there are proxies with the same
5858
`number_of_bad_checks`, sorts them by `response_time`
5959

60-
* `limit` (integer) - specifying how many proxies to return
61-
* `offset` (integer) - specifying how many proxies to skip
60+
* `limit` (integer) - specifies how many proxies to return (1024 if not provided)
61+
* `offset` (integer) - specifies how many proxies to skip (0 if not provided)
6262

6363
Example of `get` request:
64+
6465
```json
6566

6667
{
@@ -100,7 +101,9 @@ Response
100101
}
101102
```
102103

103-
* `count` (integer) - total number of proxies for that request
104+
Response fiels:
105+
106+
* `count` (integer) - total number of proxies for that request(how many you can fetch increasing offset)
104107
* `data` (array) - list of proxies
105108
* `has_more` (boolean) - value indicating whether you can increase
106109
offset to get more proxies or not
@@ -132,4 +135,18 @@ Response:
132135

133136
### count method
134137

135-
Same as get, but not returns data
138+
Same as get, but doesn't return data
139+
140+
# proxy_py API v2
141+
142+
Second version of API has only 2 methods so far
143+
144+
```bash
145+
curl https://localhost:55555/api/v2/get_proxy_for_id --data '{"id": "ID"}'
146+
```
147+
```bash
148+
curl https://localhost:55555/api/v2/get_proxies_for_id --data '{"id": "ID", "number": 2}'
149+
```
150+
151+
get_proxy_for_id should return the best proxy for a given ID avoiding overlapping with other IDs, but so far it just returns a random one ignoring ID at all.
152+
get_proxies_for_id is the same, but also has a parameter `number` to specify the number of proxies to return.

docs/source/conf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
'sphinx.ext.doctest',
3636
'sphinx.ext.todo',
3737
'sphinx.ext.coverage',
38-
'sphinx.ext.pngmath',
3938
'sphinx.ext.ifconfig',
4039
'sphinx.ext.viewcode',
4140
]

docs/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Contents:
1212
:maxdepth: 2
1313

1414
readme_link
15-
api_v1_overview.md
15+
api_overview.md
1616

1717
guides/guides
1818

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
check\_from\_stdin module
2+
=========================
3+
4+
.. automodule:: check_from_stdin
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
checkers.google\_com\_checker module
2+
====================================
3+
4+
.. automodule:: checkers.google_com_checker
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:

docs/source/modules/checkers.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Submodules
88

99
checkers.base_checker
1010
checkers.d3d_info_checker
11+
checkers.google_com_checker
1112
checkers.ipinfo_io_checker
1213

1314
Module contents
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
collectors.abstract\_collector module
2+
=====================================
3+
4+
.. automodule:: collectors.abstract_collector
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:

docs/source/modules/collectors.rst

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,12 @@
11
collectors package
22
==================
33

4-
Subpackages
5-
-----------
6-
7-
.. toctree::
8-
9-
collectors.checkerproxy_net
10-
collectors.free_proxy_list_net
11-
collectors.freeproxylists_net
12-
collectors.gatherproxy_com
13-
collectors.nordvpn_com
14-
collectors.premproxy_com
15-
collectors.proxy_list_org
16-
174
Submodules
185
----------
196

207
.. toctree::
218

22-
collectors.collector
9+
collectors.abstract_collector
2310
collectors.pages_collector
2411

2512
Module contents

docs/source/modules/http_client.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
http\_client module
2+
===================
3+
4+
.. automodule:: http_client
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
materialized\_view\_updater module
2+
==================================
3+
4+
.. automodule:: materialized_view_updater
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:

docs/source/modules/modules.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,20 @@ proxy_py Modules
55
:maxdepth: 4
66

77
async_requests
8+
check_from_stdin
89
checkers
910
collectors
1011
collectors_list
11-
dump_db
12-
fill_db
12+
http_client
1313
main
14+
materialized_view_updater
1415
models
16+
parsers
1517
processor
1618
proxy_py
1719
proxy_utils
20+
proxy_validator
1821
server
1922
setup
23+
statistics
24+
tests
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
parsers.regex\_parser module
2+
============================
3+
4+
.. automodule:: parsers.regex_parser
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:

docs/source/modules/parsers.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
parsers package
2+
===============
3+
4+
Submodules
5+
----------
6+
7+
.. toctree::
8+
9+
parsers.regex_parser
10+
11+
Module contents
12+
---------------
13+
14+
.. automodule:: parsers
15+
:members:
16+
:undoc-members:
17+
:show-inheritance:

0 commit comments

Comments
 (0)