@@ -10,7 +10,7 @@ proxy_py is a program which collects proxies, saves them in database and makes p
10
10
11
11
2 Install requirements
12
12
13
- ```
13
+ ``` bash
14
14
cd proxy_py
15
15
pip3 install -r requirements.txt
16
16
```
@@ -33,7 +33,7 @@ pip3 install -r requirements.txt
33
33
34
34
proxy_py has server based on aiohttp which is listening 127.0.0.1:55555(you can change it in settings file) and provides proxies. To get proxies you should send following json request:
35
35
36
- ```
36
+ ``` json
37
37
{
38
38
'model': 'proxy',
39
39
'method': 'get',
@@ -46,7 +46,7 @@ You can skip it. The required fields are model and method.
46
46
47
47
It will return json response like this:
48
48
49
- ```
49
+ ``` json
50
50
{
51
51
'status': 'ok',
52
52
'count': 1,
@@ -70,7 +70,7 @@ Note: All fields except *protocol*, *domain*, *port*, *auth_data*, *checking_per
70
70
71
71
Or error if something went wrong:
72
72
73
- ```
73
+ ``` json
74
74
{
75
75
'status': 'error',
76
76
'error_message': 'You should specify model',
@@ -87,7 +87,7 @@ Example using httpie:
87
87
88
88
Example using python requests library:
89
89
90
- ```
90
+ ``` python
91
91
import requests
92
92
import json
93
93
@@ -108,7 +108,7 @@ def get_proxies():
108
108
```
109
109
Example using aiohttp library:
110
110
111
- ```
111
+ ``` python
112
112
import aiohttp
113
113
114
114
@@ -150,34 +150,34 @@ If you made changes to code and want to check that you didn't break anything, go
150
150
151
151
4 create unprivileged user in postgresql database and add database authentication data to settings.py
152
152
153
- ```
153
+ ``` bash
154
154
proxy_py@server:~ /proxy_py$ vim proxy_py/settings.py
155
155
```
156
156
157
- ```
157
+ ``` bash
158
158
DATABASE_CONNECTION_ARGS = (
159
159
' postgresql://USERNAME:PASSWORD@localhost/DB_NAME' ,
160
160
)
161
161
```
162
162
163
163
5 Copy supervisor config example and change it for your case
164
164
165
- ```
165
+ ``` bash
166
166
root@server:~ $ cp /home/proxy_py/proxy_py/config_examples/proxy_py.supervisor.conf /etc/supervisor/conf.d/proxy_py.conf
167
167
root@server:~ $ vim /etc/supervisor/conf.d/proxy_py.conf
168
168
```
169
169
170
170
6 Copy nginx config example, enable it and change if you need
171
171
172
- ```
172
+ ``` bash
173
173
root@server:~ $ cp /home/proxy_py/proxy_py/config_examples/proxy_py.nginx.conf /etc/nginx/sites-available/proxy_py
174
174
root@server:~ $ ln -s /etc/nginx/sites-available/proxy_py /etc/nginx/sites-enabled/
175
175
root@server:~ $ vim /etc/nginx/sites-available/proxy_py
176
176
```
177
177
178
178
7 Restart supervisor and nginx
179
179
180
- ```
180
+ ``` bash
181
181
root@server:~ $ supervisorctl reread
182
182
root@server:~ $ supervisorctl update
183
183
root@server:~ $ /etc/init.d/nginx configtest
0 commit comments