Skip to content

Commit

Permalink
fix(Basic): Make query case-insensitive
Browse files Browse the repository at this point in the history
Fixes #88
  • Loading branch information
rlaphoenix committed Apr 1, 2024
1 parent f25d241 commit 6dd1dff
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions devine/core/proxies/basic.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import random
from typing import Optional
from typing import Optional, Union

from devine.core.proxies.proxy import Proxy


class Basic(Proxy):
def __init__(self, **countries):
def __init__(self, **countries: dict[str, Union[str, list[str]]]):
"""Basic Proxy Service using Proxies specified in the config."""
self.countries = countries
self.countries = {
k.lower(): v
for k, v in countries.items()
}

def __repr__(self) -> str:
countries = len(self.countries)
Expand All @@ -18,6 +21,7 @@ def __repr__(self) -> str:
def get_proxy(self, query: str) -> Optional[str]:
"""Get a proxy URI from the config."""
servers = self.countries.get(query)
query = query.lower()
if not servers:
return

Expand Down

0 comments on commit 6dd1dff

Please sign in to comment.