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
|
||||
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.
|
||||
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`.
|
||||
|
||||
Do note that each key's value is not a string but a list or sequence.
|
||||
It will randomly choose which entry to use.
|
||||
|
||||
For example,
|
||||
Do note that each key's value can be a list of strings, or a string. For example,
|
||||
|
||||
```yaml
|
||||
us:
|
||||
- "http://john%40email.tld:password123@proxy-us.domain.tld:8080"
|
||||
- "http://jane%40email.tld:password456@proxy-us.domain2.tld:8080"
|
||||
de:
|
||||
- "http://127.0.0.1:8888"
|
||||
de: "https://127.0.0.1:8080"
|
||||
```
|
||||
|
||||
Note that if multiple proxies are defined for a region, then it will randomly choose which one to use.
|
||||
|
||||
### nordvpn (dict)
|
||||
|
||||
Set your NordVPN Service credentials with `username` and `password` keys to automate the use of NordVPN as a Proxy
|
||||
|
|
|
@ -29,7 +29,10 @@ class Basic(Proxy):
|
|||
if not servers:
|
||||
return
|
||||
|
||||
proxy = random.choice(servers)
|
||||
if isinstance(servers, str):
|
||||
proxy = servers
|
||||
else:
|
||||
proxy = random.choice(servers)
|
||||
|
||||
proxy = prepend_scheme_if_needed(proxy, "http")
|
||||
parsed_proxy = parse_url(proxy)
|
||||
|
|
Loading…
Reference in New Issue