python-ipware 1.0.5__py3-none-any.whl → 2.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ipware → python_ipware}/__init__.py +1 -1
- python_ipware/__version__.py +1 -0
- ipware/ipware.py → python_ipware/python_ipware.py +1 -2
- {python_ipware-1.0.5.dist-info → python_ipware-2.0.1.dist-info}/METADATA +5 -5
- python_ipware-2.0.1.dist-info/RECORD +9 -0
- {python_ipware-1.0.5.dist-info → python_ipware-2.0.1.dist-info}/WHEEL +1 -1
- python_ipware-2.0.1.dist-info/top_level.txt +1 -0
- ipware/__version__.py +0 -1
- python_ipware-1.0.5.dist-info/RECORD +0 -9
- python_ipware-1.0.5.dist-info/top_level.txt +0 -1
- {ipware → python_ipware}/py.typed +0 -0
- {python_ipware-1.0.5.dist-info → python_ipware-2.0.1.dist-info}/LICENSE +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
from .
|
|
1
|
+
from .python_ipware import IpWare # noqa
|
|
2
2
|
from .__version__ import __version__ # noqa
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "2.0.1"
|
|
@@ -26,7 +26,6 @@ class IpWareMeta:
|
|
|
26
26
|
"HTTP_X_CLUSTER_CLIENT_IP", # Rackspace LB and Riverbed Stingray
|
|
27
27
|
"HTTP_FORWARDED_FOR", # RFC 7239
|
|
28
28
|
"HTTP_FORWARDED", # RFC 7239
|
|
29
|
-
"HTTP_VIA", # Squid and others
|
|
30
29
|
"X-CLIENT-IP", # Microsoft Azure
|
|
31
30
|
"X-REAL-IP", # NGINX
|
|
32
31
|
"X-CLUSTER-CLIENT-IP", # Rackspace Cloud Load Balancers
|
|
@@ -106,7 +105,7 @@ class IpWareIpAddress:
|
|
|
106
105
|
ip = ipaddress.IPv4Address(ipv4)
|
|
107
106
|
except ipaddress.AddressValueError:
|
|
108
107
|
# not a valid IP address, return None
|
|
109
|
-
logging.
|
|
108
|
+
logging.info("Invalid ip address. {0}".format(ip_str))
|
|
110
109
|
ip = None
|
|
111
110
|
return ip
|
|
112
111
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: python-ipware
|
|
3
|
-
Version:
|
|
3
|
+
Version: 2.0.1
|
|
4
4
|
Summary: A Python package to retrieve user's IP address
|
|
5
5
|
Author-email: Val Neekman <info@neekware.com>
|
|
6
6
|
License: MIT
|
|
@@ -19,6 +19,7 @@ Classifier: Programming Language :: Python :: 3.8
|
|
|
19
19
|
Classifier: Programming Language :: Python :: 3.9
|
|
20
20
|
Classifier: Programming Language :: Python :: 3.10
|
|
21
21
|
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
23
|
Requires-Python: >=3.7
|
|
23
24
|
Description-Content-Type: text/markdown
|
|
24
25
|
License-File: LICENSE
|
|
@@ -71,7 +72,7 @@ pip3 install python-ipware
|
|
|
71
72
|
Here's a basic example of how to use `python-ipware` in a view or middleware where the `request` object is available. This can be applied in Django, Flask, or other similar frameworks.
|
|
72
73
|
|
|
73
74
|
```python
|
|
74
|
-
from
|
|
75
|
+
from python_ipware import IpWare
|
|
75
76
|
|
|
76
77
|
# Instantiate IpWare with default values
|
|
77
78
|
ipw = IpWare()
|
|
@@ -133,7 +134,6 @@ request_headers_precedence_order = (
|
|
|
133
134
|
"HTTP_X_CLUSTER_CLIENT_IP", # Rackspace LB and Riverbed Stingray
|
|
134
135
|
"HTTP_FORWARDED_FOR", # RFC 7239
|
|
135
136
|
"HTTP_FORWARDED", # RFC 7239
|
|
136
|
-
"HTTP_VIA", # Squid and others
|
|
137
137
|
"X-CLIENT-IP", # Microsoft Azure
|
|
138
138
|
"X-REAL-IP", # NGINX
|
|
139
139
|
"X-CLUSTER-CLIENT-IP", # Rackspace Cloud Load Balancers
|
|
@@ -216,7 +216,7 @@ You can customize the proxy count by providing your `proxy_count` during initial
|
|
|
216
216
|
|
|
217
217
|
```python
|
|
218
218
|
# In the above scenario, the total number of proxies can be used as a way to filter out unwanted requests.
|
|
219
|
-
from
|
|
219
|
+
from python_ipware import IpWare
|
|
220
220
|
|
|
221
221
|
# enforce proxy count
|
|
222
222
|
ipw = IpWare(proxy_count=1)
|
|
@@ -249,7 +249,7 @@ In the following `example`, your public load balancer (LB) can be seen as the `o
|
|
|
249
249
|
```python
|
|
250
250
|
# We make best attempt to return the first public IP address based on header precedence
|
|
251
251
|
# Then we fall back on private, followed by loopback
|
|
252
|
-
from
|
|
252
|
+
from python_ipware import IpWare
|
|
253
253
|
|
|
254
254
|
# no proxy enforce in this example
|
|
255
255
|
ipw = IpWare()
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
python_ipware/__init__.py,sha256=TCZx4mt5Gxr2D_zNU6j0ynopdsAN_v4xeiTWz1OXSpY,87
|
|
2
|
+
python_ipware/__version__.py,sha256=wAxkK8w13vqoF47A8iqWdSlIgRRXmZiQ0R4wePZfzhs,22
|
|
3
|
+
python_ipware/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
python_ipware/python_ipware.py,sha256=PacCjg03wsKID34e7FMO5dJnaus2GUvV20_eVew3SzY,12032
|
|
5
|
+
python_ipware-2.0.1.dist-info/LICENSE,sha256=MLpNxpqfTc4TLdcDk3x6k7Vz4lJGBNLV-SxQZlFMDU8,1103
|
|
6
|
+
python_ipware-2.0.1.dist-info/METADATA,sha256=ccujv0l5NTyvrVRtlhKcFmsrjIZsMOsE5n20bcaUILw,14814
|
|
7
|
+
python_ipware-2.0.1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
8
|
+
python_ipware-2.0.1.dist-info/top_level.txt,sha256=URE4dvjpReJtRHyQpJqoBow5EWt_RqVXFn85B9Tq5Xw,14
|
|
9
|
+
python_ipware-2.0.1.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
python_ipware
|
ipware/__version__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.0.5"
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
ipware/__init__.py,sha256=rEijKhuC8P0o3aMQxdUTt_fFAPk19egTAbT-Fv_B3j0,80
|
|
2
|
-
ipware/__version__.py,sha256=B9kKWJLln1i8LjtkcYecvNWGLTrez4gCUOHtnPlInFo,22
|
|
3
|
-
ipware/ipware.py,sha256=7q9-vBHx2l9SGBCxrFTx8HbtBuzr4rDg3BjFFkXq6k8,12081
|
|
4
|
-
ipware/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
-
python_ipware-1.0.5.dist-info/LICENSE,sha256=MLpNxpqfTc4TLdcDk3x6k7Vz4lJGBNLV-SxQZlFMDU8,1103
|
|
6
|
-
python_ipware-1.0.5.dist-info/METADATA,sha256=yY13g5zj8RnBQA_mnpRYMswwzi1cfL_ls5NXA-T6WiQ,14778
|
|
7
|
-
python_ipware-1.0.5.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
|
|
8
|
-
python_ipware-1.0.5.dist-info/top_level.txt,sha256=b14WbqBzwJvbNcvi10o0hCgEZxc89c5RmfVOtUnx2AY,7
|
|
9
|
-
python_ipware-1.0.5.dist-info/RECORD,,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
ipware
|
|
File without changes
|
|
File without changes
|