Skip to content

Commit b13e357

Browse files
committed
Clarify that asynchronous handler is only supported for Python versions 3.9 and 3.10
1 parent ac9c572 commit b13e357

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ New York City
6969
Internally the library uses `aiohttp`, but as long as you provide an event
7070
loop (as in this example via `asyncio`), it shouldn't matter.
7171

72+
NOTE: due to API changes in the `asyncio` library, the asynchronous implementation only supports Python version 3.9 and 3.10.
73+
7274
### Usage
7375

7476
The `Handler.getDetails()` method accepts an IP address as an optional, positional argument. If no IP address is specified, the API will return data for the IP address from which it receives the request.

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ async-timeout==4.0.2
1414
# via aiohttp
1515
attrs==22.1.0
1616
# via aiohttp
17-
backports-asyncio-runner==1.2.0
17+
backports-asyncio-runner==1.2.0; python_version < "3.11"
1818
# via pytest-asyncio
1919
black==22.6.0
2020
# via -r requirements.in

tests/handler_async_test.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import json
22
import os
3+
import sys
34

45
from ipinfo.cache.default import DefaultCache
56
from ipinfo.details import Details
@@ -11,6 +12,8 @@
1112
import pytest
1213
import aiohttp
1314

15+
skip_if_python_3_11_or_later = sys.version_info >= (3, 11)
16+
1417

1518
class MockResponse:
1619
def __init__(self, text, status, headers):
@@ -195,6 +198,7 @@ def _check_batch_details(ips, details, token):
195198
assert "domains" in d
196199

197200

201+
@pytest.mark.skipif(skip_if_python_3_11_or_later, reason="Requires Python 3.10 or earlier")
198202
@pytest.mark.parametrize("batch_size", [None, 1, 2, 3])
199203
@pytest.mark.asyncio
200204
async def test_get_batch_details(batch_size):
@@ -225,6 +229,7 @@ async def test_get_iterative_batch_details(batch_size):
225229
_check_iterative_batch_details(ips, details, token)
226230

227231

232+
@pytest.mark.skipif(skip_if_python_3_11_or_later, reason="Requires Python 3.10 or earlier")
228233
@pytest.mark.parametrize("batch_size", [None, 1, 2, 3])
229234
@pytest.mark.asyncio
230235
async def test_get_batch_details_total_timeout(batch_size):

0 commit comments

Comments
 (0)