Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ci #112

Closed
wants to merge 31 commits into from
Closed

Ci #112

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: setup python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand All @@ -52,6 +52,6 @@ jobs:
- name: Run test
run: coverage run --source=ipware manage.py test
- name: Coveralls
run: coveralls --service=github
uses: coverallsapp/github-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 6.0.4

Enhancement:
- Add typings (thx: @federicobond)

# 6.0.3

Enhancement:
Expand Down
2 changes: 1 addition & 1 deletion ipware/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
__url__ = 'https://github.com/un33k/django-ipware'
__license__ = 'MIT'
__copyright__ = 'Copyright 2023 Val Neekman @ Neekware Inc.'
__version__ = '6.0.3'
__version__ = '6.0.4'
15 changes: 9 additions & 6 deletions ipware/ip.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
from typing import Iterable, Literal, Optional, Tuple

from django.conf import settings
from django.http import HttpRequest
from python_ipware import IpWare


def get_client_ip(
request,
proxy_order='left-most',
proxy_count=None,
proxy_trusted_ips=None,
request_header_order=None,
):
request: HttpRequest,
proxy_order: Literal['left-most', 'right-most'] = 'left-most',
proxy_count: Optional[int] = None,
proxy_trusted_ips: Optional[Iterable[str]] = None,
request_header_order: Optional[Iterable[str]] = None,
) -> Tuple[str, bool]:
leftmost = proxy_order == 'left-most'
proxy_count = proxy_count if proxy_count is not None else getattr(settings, 'IPWARE_META_PROXY_COUNT', 0)
proxy_list = proxy_trusted_ips if proxy_trusted_ips is not None else []
Expand Down