Skip to content

Commit dd46219

Browse files
committed
1 parent a5f83a8 commit dd46219

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

geoip2/webservice.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@
5656
f"GeoIP2-Python-Client/{geoip2.__version__} {requests.utils.default_user_agent()}"
5757
)
5858

59+
# We have this so that we can avoid a mocket issue:
60+
# https://github.com/mindflayer/python-mocket/issues/209
61+
_SCHEME = "https"
62+
5963

6064
class BaseClient: # pylint: disable=missing-class-docstring, too-few-public-methods
6165
_account_id: str
@@ -84,7 +88,7 @@ def __init__(
8488
account_id if isinstance(account_id, bytes) else str(account_id)
8589
)
8690
self._license_key = license_key
87-
self._base_uri = f"https://{host}/geoip/v2.1"
91+
self._base_uri = f"{_SCHEME}://{host}/geoip/v2.1"
8892
self._timeout = timeout
8993

9094
def _uri(self, path: str, ip_address: IPAddress) -> str:

tests/webservice_test.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,16 @@
2525
OutOfQueriesError,
2626
PermissionRequiredError,
2727
)
28+
import geoip2.webservice
2829
from geoip2.webservice import AsyncClient, Client
2930

31+
# We have this so that we can avoid a mocket issue:
32+
# https://github.com/mindflayer/python-mocket/issues/209
33+
geoip2.webservice._SCHEME = "http"
34+
3035

3136
class TestBaseClient(unittest.TestCase):
32-
base_uri = "https://geoip.maxmind.com/geoip/v2.1/"
37+
base_uri = "http://geoip.maxmind.com/geoip/v2.1/"
3338
country = {
3439
"continent": {"code": "NA", "geoname_id": 42, "names": {"en": "North America"}},
3540
"country": {

0 commit comments

Comments
 (0)