python-ipware 1.0.5__tar.gz → 2.0.1__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-ipware
3
- Version: 1.0.5
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 ipware import IpWare
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 ipware import IpWare
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 ipware import IpWare
252
+ from python_ipware import IpWare
253
253
 
254
254
  # no proxy enforce in this example
255
255
  ipw = IpWare()
@@ -41,7 +41,7 @@ pip3 install python-ipware
41
41
  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.
42
42
 
43
43
  ```python
44
- from ipware import IpWare
44
+ from python_ipware import IpWare
45
45
 
46
46
  # Instantiate IpWare with default values
47
47
  ipw = IpWare()
@@ -103,7 +103,6 @@ request_headers_precedence_order = (
103
103
  "HTTP_X_CLUSTER_CLIENT_IP", # Rackspace LB and Riverbed Stingray
104
104
  "HTTP_FORWARDED_FOR", # RFC 7239
105
105
  "HTTP_FORWARDED", # RFC 7239
106
- "HTTP_VIA", # Squid and others
107
106
  "X-CLIENT-IP", # Microsoft Azure
108
107
  "X-REAL-IP", # NGINX
109
108
  "X-CLUSTER-CLIENT-IP", # Rackspace Cloud Load Balancers
@@ -186,7 +185,7 @@ You can customize the proxy count by providing your `proxy_count` during initial
186
185
 
187
186
  ```python
188
187
  # In the above scenario, the total number of proxies can be used as a way to filter out unwanted requests.
189
- from ipware import IpWare
188
+ from python_ipware import IpWare
190
189
 
191
190
  # enforce proxy count
192
191
  ipw = IpWare(proxy_count=1)
@@ -219,7 +218,7 @@ In the following `example`, your public load balancer (LB) can be seen as the `o
219
218
  ```python
220
219
  # We make best attempt to return the first public IP address based on header precedence
221
220
  # Then we fall back on private, followed by loopback
222
- from ipware import IpWare
221
+ from python_ipware import IpWare
223
222
 
224
223
  # no proxy enforce in this example
225
224
  ipw = IpWare()
@@ -26,6 +26,7 @@ classifiers = [
26
26
  "Programming Language :: Python :: 3.9",
27
27
  "Programming Language :: Python :: 3.10",
28
28
  "Programming Language :: Python :: 3.11",
29
+ "Programming Language :: Python :: 3.12",
29
30
  ]
30
31
 
31
32
  [project.urls]
@@ -43,14 +44,14 @@ dev = [
43
44
  ]
44
45
 
45
46
  [tool.setuptools]
46
- packages = ["ipware"]
47
+ packages = ["python_ipware"]
47
48
 
48
49
  [tool.setuptools.dynamic]
49
- version = {attr = "ipware.__version__"}
50
+ version = {attr = "python_ipware.__version__"}
50
51
  readme = {file = ["README.md"], content-type = "text/markdown"}
51
52
 
52
53
  [tool.setuptools.package-data]
53
- "ipware" = ["py.typed"]
54
+ "python_ipware" = ["py.typed"]
54
55
 
55
56
  [tool.ruff]
56
57
  select = [
@@ -85,5 +86,5 @@ max-complexity = 16
85
86
 
86
87
  [tool.coverage.run]
87
88
  omit = [
88
- "ipware/__version__.py"
89
+ "python_ipware/__version__.py"
89
90
  ]
@@ -1,2 +1,2 @@
1
- from .ipware import IpWare # noqa
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.exception("Invalid ip address. {0}".format(ip_str))
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: 1.0.5
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 ipware import IpWare
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 ipware import IpWare
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 ipware import IpWare
252
+ from python_ipware import IpWare
253
253
 
254
254
  # no proxy enforce in this example
255
255
  ipw = IpWare()
@@ -1,10 +1,10 @@
1
1
  LICENSE
2
2
  README.md
3
3
  pyproject.toml
4
- ipware/__init__.py
5
- ipware/__version__.py
6
- ipware/ipware.py
7
- ipware/py.typed
4
+ python_ipware/__init__.py
5
+ python_ipware/__version__.py
6
+ python_ipware/py.typed
7
+ python_ipware/python_ipware.py
8
8
  python_ipware.egg-info/PKG-INFO
9
9
  python_ipware.egg-info/SOURCES.txt
10
10
  python_ipware.egg-info/dependency_links.txt
@@ -0,0 +1 @@
1
+ python_ipware
@@ -1,7 +1,7 @@
1
1
  import unittest
2
2
  import logging
3
3
  from ipaddress import IPv4Address
4
- from ipware import IpWare
4
+ from python_ipware import IpWare
5
5
 
6
6
  logging.disable(logging.CRITICAL) # Disable logging for the entire file
7
7
 
@@ -364,13 +364,6 @@ class TestIPv4Headers(unittest.TestCase):
364
364
  r = self.ipware.get_client_ip(meta)
365
365
  self.assertEqual(r, (IPv4Address("177.139.233.139"), False))
366
366
 
367
- def test_ipv4_http_via(self):
368
- meta = {
369
- "HTTP_VIA": "177.139.233.139",
370
- }
371
- r = self.ipware.get_client_ip(meta)
372
- self.assertEqual(r, (IPv4Address("177.139.233.139"), False))
373
-
374
367
  def test_ipv4_x_client_ip(self):
375
368
  meta = {
376
369
  "X-CLIENT-IP": "177.139.233.139",
@@ -2,7 +2,7 @@ import unittest
2
2
  import logging
3
3
  from ipaddress import IPv4Address, IPv6Address
4
4
 
5
- from ipware import IpWare
5
+ from python_ipware import IpWare
6
6
 
7
7
  logging.disable(logging.CRITICAL) # Disable logging for the entire file
8
8
 
@@ -1 +0,0 @@
1
- __version__ = "1.0.5"
File without changes
File without changes