You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+34-17Lines changed: 34 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -35,7 +35,9 @@ Yes, you can download virtualbox image [here](https://drive.google.com/file/d/1z
35
35
36
36
## How to get proxies?
37
37
38
-
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:
38
+
proxy_py has server based on aiohttp which is listening 127.0.0.1:55555
39
+
(you can change it in settings file) and provides proxies.
40
+
To get proxies you should send following json request:
39
41
40
42
```json
41
43
{
@@ -46,41 +48,47 @@ proxy_py has server based on aiohttp which is listening 127.0.0.1:55555(you can
46
48
```
47
49
48
50
Note: order_by makes result sorting by one or more fields separated by comma.
49
-
You can skip it. The required fields are model and method.
51
+
You can skip it. The required fields are `model` and `method`.
50
52
51
53
It will return json response like this:
52
54
53
55
```json
54
56
{
55
-
"status": "ok",
56
57
"count": 1,
57
-
"has_more": true,
58
58
"data": [{
59
59
"address": "http://127.0.0.1:8080",
60
-
"auth_data": null,
60
+
"auth_data": "",
61
61
"bad_proxy": false,
62
62
"domain": "127.0.0.1",
63
63
"last_check_time": 1509466165,
64
64
"number_of_bad_checks": 0,
65
65
"port": 8080,
66
66
"protocol": "http",
67
-
"uptime": 1509460949,
67
+
"response_time": 461691,
68
+
"uptime": 1509460949
68
69
}
69
-
]
70
+
],
71
+
"has_more": false,
72
+
"status": "ok",
73
+
"status_code": 200
70
74
}
71
75
```
72
76
73
-
Note: All fields except *protocol*, *domain*, *port*, *auth_data*, *checking_period* and *address* can be null
77
+
Note: All fields except *protocol*, *domain*, *port*, *auth_data*,
78
+
*checking_period* and *address* can be null
74
79
75
80
Or error if something went wrong:
76
81
77
82
```json
78
83
{
79
-
"status": "error",
80
-
"error_message": "You should specify model",
84
+
"error_message": "You should specify \"model\"",
85
+
"status": "error",
86
+
"status_code": 400
81
87
}
82
88
```
83
89
90
+
Note: status_code is also duplicated in HTTP status code
with session.post('http://example.com:55555', json=json_data) as response:
128
-
response = json.loads(await response.text())
129
-
for proxy in response['data']:
130
-
result.append(proxy['address'])
140
+
if response.status ==200:
141
+
response = json.loads(await response.text())
142
+
for proxy in response['data']:
143
+
result.append(proxy['address'])
144
+
else:
145
+
# check error here
146
+
pass
131
147
132
148
return result
133
149
```
@@ -138,7 +154,8 @@ Read more about API [here](https://github.com/DevAlone/proxy_py/tree/master/doc
138
154
139
155
## How to test it?
140
156
141
-
If you made changes to code and want to check that you didn't break anything, go [here](https://github.com/DevAlone/proxy_py/tree/master/docs/tests.md)
157
+
If you made changes to code and want to check that you didn't break
158
+
anything, go [here](https://github.com/DevAlone/proxy_py/tree/master/docs/tests.md)
142
159
143
160
## How to deploy on production using supervisor, nginx and postgresql in 8 steps?
0 commit comments