python-ipware 2.0.0__tar.gz → 2.0.2__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: 2.0.0
3
+ Version: 2.0.2
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
@@ -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
@@ -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
@@ -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]
@@ -0,0 +1 @@
1
+ __version__ = "2.0.2"
@@ -6,6 +6,8 @@ from typing import Any, Dict, List, Optional, Tuple, Union
6
6
  IpAddressType = Union[ipaddress.IPv4Address, ipaddress.IPv6Address]
7
7
  OptionalIpAddressType = Optional[IpAddressType]
8
8
 
9
+ logger = logging.getLogger(__name__)
10
+
9
11
 
10
12
  class IpWareMeta:
11
13
  """
@@ -26,7 +28,6 @@ class IpWareMeta:
26
28
  "HTTP_X_CLUSTER_CLIENT_IP", # Rackspace LB and Riverbed Stingray
27
29
  "HTTP_FORWARDED_FOR", # RFC 7239
28
30
  "HTTP_FORWARDED", # RFC 7239
29
- "HTTP_VIA", # Squid and others
30
31
  "X-CLIENT-IP", # Microsoft Azure
31
32
  "X-REAL-IP", # NGINX
32
33
  "X-CLUSTER-CLIENT-IP", # Rackspace Cloud Load Balancers
@@ -106,7 +107,7 @@ class IpWareIpAddress:
106
107
  ip = ipaddress.IPv4Address(ipv4)
107
108
  except ipaddress.AddressValueError:
108
109
  # not a valid IP address, return None
109
- logging.exception("Invalid ip address. {0}".format(ip_str))
110
+ logger.info("Invalid ip address. {0}".format(ip_str))
110
111
  ip = None
111
112
  return ip
112
113
 
@@ -325,7 +326,7 @@ class IpWare(IpWareMeta, IpWareProxy, IpWareIpAddress):
325
326
  """
326
327
 
327
328
  if not ip_list:
328
- logging.warning("Invalid ip list provided.")
329
+ logger.warning("Invalid ip list provided.")
329
330
  return None, False
330
331
 
331
332
  # the incoming ips match our trusted proxy list
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-ipware
3
- Version: 2.0.0
3
+ Version: 2.0.2
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
@@ -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
@@ -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",
@@ -1 +0,0 @@
1
- __version__ = "2.0.0"
File without changes
File without changes