From 235d9cfdef4e6f5686a0be843f81062a7976a170 Mon Sep 17 00:00:00 2001 From: Gregory Oschwald Date: Fri, 19 Jan 2024 08:40:13 -0800 Subject: [PATCH] Test with HTTPS again mocket 3.12.3 fixed an issue we were having that caused HTTPS requests to fail. --- geoip2/webservice.py | 6 +----- pyproject.toml | 2 +- tests/webservice_test.py | 7 +------ 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/geoip2/webservice.py b/geoip2/webservice.py index 8f796f7..2c5eb81 100644 --- a/geoip2/webservice.py +++ b/geoip2/webservice.py @@ -56,10 +56,6 @@ f"GeoIP2-Python-Client/{geoip2.__version__} {requests.utils.default_user_agent()}" ) -# We have this so that we can avoid a mocket issue: -# https://github.com/mindflayer/python-mocket/issues/209 -_SCHEME = "https" - class BaseClient: # pylint: disable=missing-class-docstring, too-few-public-methods _account_id: str @@ -88,7 +84,7 @@ def __init__( account_id if isinstance(account_id, bytes) else str(account_id) ) self._license_key = license_key - self._base_uri = f"{_SCHEME}://{host}/geoip/v2.1" + self._base_uri = f"https://{host}/geoip/v2.1" self._timeout = timeout def _uri(self, path: str, ip_address: IPAddress) -> str: diff --git a/pyproject.toml b/pyproject.toml index cc38cc1..96fb02d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,7 +37,7 @@ classifiers = [ [project.optional-dependencies] test = [ - "mocket>=3.11.1", + "mocket>=3.12.3", ] [tool.setuptools.package-data] diff --git a/tests/webservice_test.py b/tests/webservice_test.py index 956f465..4e8a7a7 100644 --- a/tests/webservice_test.py +++ b/tests/webservice_test.py @@ -25,16 +25,11 @@ OutOfQueriesError, PermissionRequiredError, ) -import geoip2.webservice from geoip2.webservice import AsyncClient, Client -# We have this so that we can avoid a mocket issue: -# https://github.com/mindflayer/python-mocket/issues/209 -geoip2.webservice._SCHEME = "http" - class TestBaseClient(unittest.TestCase): - base_uri = "http://geoip.maxmind.com/geoip/v2.1/" + base_uri = "https://geoip.maxmind.com/geoip/v2.1/" country = { "continent": {"code": "NA", "geoname_id": 42, "names": {"en": "North America"}}, "country": {