smartystreets-python-sdk 5.5.0__tar.gz → 5.6.0__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.
Files changed (89) hide show
  1. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/PKG-INFO +2 -2
  2. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/client_builder.py +22 -7
  3. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/requests_sender.py +3 -7
  4. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk.egg-info/PKG-INFO +2 -2
  5. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk_version/__init__.py +1 -1
  6. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/LICENSE.md +0 -0
  7. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/README.md +0 -0
  8. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/setup.cfg +0 -0
  9. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/setup.py +0 -0
  10. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/__init__.py +0 -0
  11. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/basic_auth_credentials.py +0 -0
  12. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/batch.py +0 -0
  13. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/custom_header_sender.py +0 -0
  14. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/custom_query_sender.py +0 -0
  15. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/errors.py +0 -0
  16. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/exceptions.py +0 -0
  17. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/international_autocomplete/__init__.py +0 -0
  18. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/international_autocomplete/candidate.py +0 -0
  19. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/international_autocomplete/client.py +0 -0
  20. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/international_autocomplete/lookup.py +0 -0
  21. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/international_postal_code/__init__.py +0 -0
  22. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/international_postal_code/candidate.py +0 -0
  23. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/international_postal_code/client.py +0 -0
  24. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/international_postal_code/lookup.py +0 -0
  25. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/international_street/__init__.py +0 -0
  26. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/international_street/analysis.py +0 -0
  27. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/international_street/candidate.py +0 -0
  28. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/international_street/changes.py +0 -0
  29. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/international_street/client.py +0 -0
  30. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/international_street/components.py +0 -0
  31. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/international_street/language_mode.py +0 -0
  32. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/international_street/lookup.py +0 -0
  33. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/international_street/metadata.py +0 -0
  34. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/international_street/rootlevel.py +0 -0
  35. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/license_sender.py +0 -0
  36. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/native_serializer.py +0 -0
  37. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/proxy.py +0 -0
  38. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/request.py +0 -0
  39. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/response.py +0 -0
  40. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/retry_sender.py +0 -0
  41. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/shared_credentials.py +0 -0
  42. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/signing_sender.py +0 -0
  43. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/static_credentials.py +0 -0
  44. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/status_code_sender.py +0 -0
  45. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/url_prefix_sender.py +0 -0
  46. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/us_autocomplete_pro/__init__.py +0 -0
  47. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/us_autocomplete_pro/client.py +0 -0
  48. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/us_autocomplete_pro/geolocation_type.py +0 -0
  49. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/us_autocomplete_pro/lookup.py +0 -0
  50. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/us_autocomplete_pro/suggestion.py +0 -0
  51. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/us_enrichment/__init__.py +0 -0
  52. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/us_enrichment/client.py +0 -0
  53. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/us_enrichment/lookup.py +0 -0
  54. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/us_enrichment/response.py +0 -0
  55. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/us_extract/__init__.py +0 -0
  56. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/us_extract/address.py +0 -0
  57. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/us_extract/client.py +0 -0
  58. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/us_extract/lookup.py +0 -0
  59. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/us_extract/metadata.py +0 -0
  60. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/us_extract/result.py +0 -0
  61. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/us_reverse_geo/__init__.py +0 -0
  62. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/us_reverse_geo/address.py +0 -0
  63. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/us_reverse_geo/client.py +0 -0
  64. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/us_reverse_geo/coordinate.py +0 -0
  65. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/us_reverse_geo/lookup.py +0 -0
  66. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/us_reverse_geo/response.py +0 -0
  67. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/us_reverse_geo/result.py +0 -0
  68. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/us_street/__init__.py +0 -0
  69. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/us_street/analysis.py +0 -0
  70. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/us_street/candidate.py +0 -0
  71. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/us_street/client.py +0 -0
  72. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/us_street/component_analysis.py +0 -0
  73. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/us_street/components.py +0 -0
  74. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/us_street/lookup.py +0 -0
  75. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/us_street/match_info.py +0 -0
  76. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/us_street/match_type.py +0 -0
  77. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/us_street/metadata.py +0 -0
  78. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/us_street/output_format.py +0 -0
  79. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/us_zipcode/__init__.py +0 -0
  80. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/us_zipcode/alternate_county.py +0 -0
  81. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/us_zipcode/city.py +0 -0
  82. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/us_zipcode/client.py +0 -0
  83. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/us_zipcode/lookup.py +0 -0
  84. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/us_zipcode/result.py +0 -0
  85. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk/us_zipcode/zipcode.py +0 -0
  86. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk.egg-info/SOURCES.txt +0 -0
  87. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk.egg-info/dependency_links.txt +0 -0
  88. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk.egg-info/requires.txt +0 -0
  89. {smartystreets_python_sdk-5.5.0 → smartystreets_python_sdk-5.6.0}/smartystreets_python_sdk.egg-info/top_level.txt +0 -0
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: smartystreets_python_sdk
3
- Version: 5.5.0
3
+ Version: 5.6.0
4
4
  Summary: An official library to help Python developers easily access the SmartyStreets APIs
5
5
  Home-page: https://github.com/smartystreets/smartystreets-python-sdk
6
- Download-URL: https://github.com/smartystreets/smartystreets-python-sdk/tarball/5.5.0
6
+ Download-URL: https://github.com/smartystreets/smartystreets-python-sdk/tarball/5.6.0
7
7
  Author: SmartyStreets SDK Team
8
8
  Author-email: support@smartystreets.com
9
9
  License: Apache 2
@@ -62,7 +62,7 @@ class ClientBuilder:
62
62
 
63
63
  def with_sender(self, sender):
64
64
  """
65
- Default is a series of nested senders. (See build_sender()
65
+ Sets the innermost HTTP transport sender while keeping the full middleware chain intact.
66
66
 
67
67
  Returns self to accommodate method chaining.
68
68
  """
@@ -255,15 +255,30 @@ class ClientBuilder:
255
255
 
256
256
  def build_sender(self):
257
257
  if self.http_sender is not None:
258
- return self.http_sender
259
-
260
- sender = smarty.RequestsSender(self.max_timeout, self.proxy, self.ip, self.pool_size)
261
- sender.debug = self.debug
258
+ conflicts = []
259
+ if self.max_timeout != 10:
260
+ conflicts.append("with_max_timeout()")
261
+ if self.proxy is not None:
262
+ conflicts.append("with_http_proxy()/with_https_proxy()")
263
+ if self.debug is not None:
264
+ conflicts.append("with_debug()")
265
+ if self.pool_size is not None:
266
+ conflicts.append("with_connection_pool_size()")
267
+ if conflicts:
268
+ raise ValueError("with_sender() cannot be combined with: {}. These options only apply to the built-in HTTP transport.".format(", ".join(conflicts)))
269
+ sender = self.http_sender
270
+ else:
271
+ sender = smarty.RequestsSender(self.max_timeout, self.proxy, self.pool_size)
272
+ sender.debug = self.debug
262
273
 
263
274
  sender = smarty.StatusCodeSender(sender)
264
275
 
265
- if self.header is not None:
266
- sender = smarty.CustomHeaderSender(self.header, sender, self.append_headers)
276
+ effective_header = dict(self.header) if self.header is not None else {}
277
+ if self.ip is not None:
278
+ effective_header['X-Forwarded-For'] = self.ip
279
+
280
+ if effective_header:
281
+ sender = smarty.CustomHeaderSender(effective_header, sender, self.append_headers)
267
282
 
268
283
  if self.custom_queries is not None:
269
284
  sender = smarty.CustomQuerySender(self.custom_queries, sender)
@@ -6,17 +6,15 @@ import smartystreets_python_sdk_version as version
6
6
 
7
7
 
8
8
  class RequestsSender:
9
- def __init__(self, max_timeout=None, proxy=None, ip=None, pool_size=None):
9
+ def __init__(self, max_timeout=None, proxy=None, pool_size=None):
10
10
  self.session = Session()
11
11
  self.max_timeout = max_timeout or 10
12
12
  self.proxy = proxy
13
13
  self.debug = None
14
- self.ip = ip
15
14
  self.pool_size = pool_size
16
15
 
17
16
  def send(self, smarty_request):
18
- ip = self.ip
19
- request = build_request(smarty_request, ip)
17
+ request = build_request(smarty_request)
20
18
  if (self.pool_size != None):
21
19
  adapter = requests.adapters.HTTPAdapter(pool_connections=self.pool_size, pool_maxsize=self.pool_size)
22
20
  self.session.mount('https://', adapter)
@@ -50,15 +48,13 @@ class RequestsSender:
50
48
  return {'http': proxy_string, 'https': proxy_string}
51
49
 
52
50
 
53
- def build_request(smarty_request, ip=None):
51
+ def build_request(smarty_request):
54
52
  try:
55
53
  request = Request(url=smarty_request.url_prefix, params=smarty_request.parameters)
56
54
  request.headers['User-Agent'] = "smartystreets (sdk:python@{})".format(version.__version__)
57
55
  request.headers['Content-Type'] = smarty_request.content_type
58
56
  if smarty_request.referer:
59
57
  request.headers['Referer'] = smarty_request.referer
60
- if ip != None:
61
- request.headers['X-Forwarded-For'] = ip
62
58
  if smarty_request.auth:
63
59
  request.auth = smarty_request.auth
64
60
  if smarty_request.payload:
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: smartystreets_python_sdk
3
- Version: 5.5.0
3
+ Version: 5.6.0
4
4
  Summary: An official library to help Python developers easily access the SmartyStreets APIs
5
5
  Home-page: https://github.com/smartystreets/smartystreets-python-sdk
6
- Download-URL: https://github.com/smartystreets/smartystreets-python-sdk/tarball/5.5.0
6
+ Download-URL: https://github.com/smartystreets/smartystreets-python-sdk/tarball/5.6.0
7
7
  Author: SmartyStreets SDK Team
8
8
  Author-email: support@smartystreets.com
9
9
  License: Apache 2
@@ -1,2 +1,2 @@
1
1
  __version__ = '0.0.0' # DO NOT EDIT (this is updated by a build job when a new release is published)
2
- __version__="5.5.0"
2
+ __version__="5.6.0"