mirror of https://github.com/devine-dl/devine.git
feat(Basic): Allow single string URIs for countries
This commit is contained in:
parent
03b8945273
commit
b36befb296
12
CONFIG.md
12
CONFIG.md
|
@ -287,25 +287,23 @@ Service's GEOFENCE class property, but can also be explicitly used with `--proxy
|
||||||
to use by prefixing it with the provider key name, e.g., `--proxy basic:de` or `--proxy nordvpn:de`. Some providers
|
to use by prefixing it with the provider key name, e.g., `--proxy basic:de` or `--proxy nordvpn:de`. Some providers
|
||||||
support specific query formats for selecting a country/server.
|
support specific query formats for selecting a country/server.
|
||||||
|
|
||||||
### basic (list\[dict])
|
### basic (dict[str, str|list])
|
||||||
|
|
||||||
Define a mapping of country to proxy to use where required.
|
Define a mapping of country to proxy to use where required.
|
||||||
The keys are region Alpha 2 Country Codes. Alpha 2 Country Codes are `[a-z]{2}` codes, e.g., `us`, `gb`, and `jp`.
|
The keys are region Alpha 2 Country Codes. Alpha 2 Country Codes are `[a-z]{2}` codes, e.g., `us`, `gb`, and `jp`.
|
||||||
Don't get this mixed up with language codes like `en` vs. `gb`, or `ja` vs. `jp`.
|
Don't get this mixed up with language codes like `en` vs. `gb`, or `ja` vs. `jp`.
|
||||||
|
|
||||||
Do note that each key's value is not a string but a list or sequence.
|
Do note that each key's value can be a list of strings, or a string. For example,
|
||||||
It will randomly choose which entry to use.
|
|
||||||
|
|
||||||
For example,
|
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
us:
|
us:
|
||||||
- "http://john%40email.tld:password123@proxy-us.domain.tld:8080"
|
- "http://john%40email.tld:password123@proxy-us.domain.tld:8080"
|
||||||
- "http://jane%40email.tld:password456@proxy-us.domain2.tld:8080"
|
- "http://jane%40email.tld:password456@proxy-us.domain2.tld:8080"
|
||||||
de:
|
de: "https://127.0.0.1:8080"
|
||||||
- "http://127.0.0.1:8888"
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Note that if multiple proxies are defined for a region, then it will randomly choose which one to use.
|
||||||
|
|
||||||
### nordvpn (dict)
|
### nordvpn (dict)
|
||||||
|
|
||||||
Set your NordVPN Service credentials with `username` and `password` keys to automate the use of NordVPN as a Proxy
|
Set your NordVPN Service credentials with `username` and `password` keys to automate the use of NordVPN as a Proxy
|
||||||
|
|
|
@ -29,6 +29,9 @@ class Basic(Proxy):
|
||||||
if not servers:
|
if not servers:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if isinstance(servers, str):
|
||||||
|
proxy = servers
|
||||||
|
else:
|
||||||
proxy = random.choice(servers)
|
proxy = random.choice(servers)
|
||||||
|
|
||||||
proxy = prepend_scheme_if_needed(proxy, "http")
|
proxy = prepend_scheme_if_needed(proxy, "http")
|
||||||
|
|
Loading…
Reference in New Issue