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
python -m coverage run -m pytest tests/ --ignore=tests/integration
30
+
python -m coverage report --show-missing
31
+
```
32
+
33
+
## Adding a New Proxy Provider
34
+
35
+
If you're adding a new provider that isn't already in the library, here's a short guide to help you get started.
36
+
37
+
### 1. Create the Provider
38
+
39
+
Consider looking at `proxyproviders/providers/webshare.py` as an example. Your implemented provider will need to implement the `ProxyProvider` from `proxyproviders/proxy_provider.py`.
40
+
41
+
Here's a small scaffold that might be useful, however it may be outdated so check the `ProxyProvider` object for the latest required methods.
Each provider has their own custom options, the `Webshare` class lets you specify url params according to their [api spec](https://apidocs.webshare.io/proxy-list/list#parameters), here's an example which will only return proxies that are based in the US.
66
84
67
85
```py
@@ -107,32 +125,86 @@ some_function(brightdata)
107
125
108
126
Here's a more meaningful example that takes the `Proxy` class and uses it to create a python requests http proxy.
109
127
128
+
#### Simple Usage
110
129
```py
111
-
from proxyproviders import Webshare, BrightData, ProxyProvider
130
+
from proxyproviders import Webshare
131
+
from proxyproviders.algorithms import Random, RoundRobin
132
+
from proxyproviders.models.proxy import ProxyFormat
112
133
import requests
113
-
import os
114
134
135
+
provider = Webshare(api_key="your_api_key")
115
136
116
-
defrequest_with_proxy(provider: ProxyProvider):
117
-
requests_proxy =None
137
+
# Get proxy using default RoundRobin and make request
0 commit comments