Skip to content

Commit dc64783

Browse files
un33kfedericobond
andauthored
Ci (#113)
* Add types for get_client_ip parameters (#110) --------- Co-authored-by: Federico Bond <federicobond@gmail.com>
1 parent 410e179 commit dc64783

File tree

4 files changed

+17
-9
lines changed

4 files changed

+17
-9
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
steps:
3939
- uses: actions/checkout@v4
4040
- name: setup python
41-
uses: actions/setup-python@v4
41+
uses: actions/setup-python@v5
4242
with:
4343
python-version: ${{ matrix.python-version }}
4444
- name: Install dependencies
@@ -52,6 +52,6 @@ jobs:
5252
- name: Run test
5353
run: coverage run --source=ipware manage.py test
5454
- name: Coveralls
55-
run: coveralls --service=github
55+
uses: coverallsapp/github-action@v2
5656
env:
5757
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# 6.0.4
2+
3+
Enhancement:
4+
- Add typings (thx: @federicobond)
5+
16
# 6.0.3
27

38
Enhancement:

ipware/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
__url__ = 'https://github.com/un33k/django-ipware'
66
__license__ = 'MIT'
77
__copyright__ = 'Copyright 2023 Val Neekman @ Neekware Inc.'
8-
__version__ = '6.0.3'
8+
__version__ = '6.0.4'

ipware/ip.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1+
from typing import Iterable, Literal, Optional, Tuple
2+
13
from django.conf import settings
4+
from django.http import HttpRequest
25
from python_ipware import IpWare
36

47

58
def get_client_ip(
6-
request,
7-
proxy_order='left-most',
8-
proxy_count=None,
9-
proxy_trusted_ips=None,
10-
request_header_order=None,
11-
):
9+
request: HttpRequest,
10+
proxy_order: Literal['left-most', 'right-most'] = 'left-most',
11+
proxy_count: Optional[int] = None,
12+
proxy_trusted_ips: Optional[Iterable[str]] = None,
13+
request_header_order: Optional[Iterable[str]] = None,
14+
) -> Tuple[str, bool]:
1215
leftmost = proxy_order == 'left-most'
1316
proxy_count = proxy_count if proxy_count is not None else getattr(settings, 'IPWARE_META_PROXY_COUNT', 0)
1417
proxy_list = proxy_trusted_ips if proxy_trusted_ips is not None else []

0 commit comments

Comments
 (0)