smartystreets-python-sdk 5.0.0__tar.gz → 5.2.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.
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/PKG-INFO +2 -2
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/client_builder.py +28 -4
- smartystreets_python_sdk-5.2.0/smartystreets_python_sdk/custom_header_sender.py +35 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/us_street/analysis.py +19 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/us_street/candidate.py +26 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/us_street/component_analysis.py +20 -1
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/us_street/components.py +24 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/us_street/lookup.py +25 -0
- smartystreets_python_sdk-5.2.0/smartystreets_python_sdk/us_street/match_info.py +14 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/us_street/metadata.py +23 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk.egg-info/PKG-INFO +2 -2
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk_version/__init__.py +1 -1
- smartystreets_python_sdk-5.0.0/smartystreets_python_sdk/custom_header_sender.py +0 -21
- smartystreets_python_sdk-5.0.0/smartystreets_python_sdk/us_street/match_info.py +0 -7
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/LICENSE.md +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/README.md +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/setup.cfg +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/setup.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/__init__.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/basic_auth_credentials.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/batch.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/custom_query_sender.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/errors.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/exceptions.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/international_autocomplete/__init__.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/international_autocomplete/candidate.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/international_autocomplete/client.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/international_autocomplete/lookup.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/international_postal_code/__init__.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/international_postal_code/candidate.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/international_postal_code/client.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/international_postal_code/lookup.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/international_street/__init__.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/international_street/analysis.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/international_street/candidate.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/international_street/changes.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/international_street/client.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/international_street/components.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/international_street/language_mode.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/international_street/lookup.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/international_street/metadata.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/international_street/rootlevel.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/license_sender.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/native_serializer.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/proxy.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/request.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/requests_sender.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/response.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/retry_sender.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/shared_credentials.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/signing_sender.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/static_credentials.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/status_code_sender.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/url_prefix_sender.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/us_autocomplete_pro/__init__.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/us_autocomplete_pro/client.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/us_autocomplete_pro/geolocation_type.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/us_autocomplete_pro/lookup.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/us_autocomplete_pro/suggestion.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/us_enrichment/__init__.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/us_enrichment/client.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/us_enrichment/lookup.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/us_enrichment/response.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/us_extract/__init__.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/us_extract/address.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/us_extract/client.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/us_extract/lookup.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/us_extract/metadata.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/us_extract/result.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/us_reverse_geo/__init__.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/us_reverse_geo/address.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/us_reverse_geo/client.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/us_reverse_geo/coordinate.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/us_reverse_geo/lookup.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/us_reverse_geo/response.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/us_reverse_geo/result.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/us_street/__init__.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/us_street/client.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/us_street/match_type.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/us_street/output_format.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/us_zipcode/__init__.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/us_zipcode/alternate_county.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/us_zipcode/city.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/us_zipcode/client.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/us_zipcode/lookup.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/us_zipcode/result.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/us_zipcode/zipcode.py +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk.egg-info/SOURCES.txt +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk.egg-info/dependency_links.txt +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk.egg-info/requires.txt +0 -0
- {smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.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.
|
|
3
|
+
Version: 5.2.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.
|
|
6
|
+
Download-URL: https://github.com/smartystreets/smartystreets-python-sdk/tarball/5.2.0
|
|
7
7
|
Author: SmartyStreets SDK Team
|
|
8
8
|
Author-email: support@smartystreets.com
|
|
9
9
|
License: Apache 2
|
|
@@ -27,6 +27,7 @@ class ClientBuilder:
|
|
|
27
27
|
self.ip = None
|
|
28
28
|
self.debug = None
|
|
29
29
|
self.header = None
|
|
30
|
+
self.append_headers = {}
|
|
30
31
|
self.licenses = []
|
|
31
32
|
self.pool_size = None
|
|
32
33
|
self.custom_queries = None
|
|
@@ -113,13 +114,36 @@ class ClientBuilder:
|
|
|
113
114
|
|
|
114
115
|
def with_custom_header(self, custom_header):
|
|
115
116
|
"""
|
|
116
|
-
Create custom headers when necessary.
|
|
117
|
+
Create custom headers when necessary. Headers are merged with any existing custom headers.
|
|
117
118
|
:param custom_header: Input your custom headers
|
|
118
119
|
:return: Returns self to accommodate method chaining
|
|
119
120
|
"""
|
|
120
|
-
self.header
|
|
121
|
+
if self.header is None:
|
|
122
|
+
self.header = {}
|
|
123
|
+
self.header.update(custom_header)
|
|
121
124
|
return self
|
|
122
|
-
|
|
125
|
+
|
|
126
|
+
def with_appended_header(self, key, value, separator):
|
|
127
|
+
"""
|
|
128
|
+
Appends the provided value to the existing header value using the specified separator,
|
|
129
|
+
rather than adding a separate header value. This is useful for single-value headers like User-Agent.
|
|
130
|
+
:param key: The header key
|
|
131
|
+
:param value: The header value to append
|
|
132
|
+
:param separator: The separator to use when joining values
|
|
133
|
+
:return: Returns self to accommodate method chaining
|
|
134
|
+
"""
|
|
135
|
+
self.append_headers[key] = separator
|
|
136
|
+
if self.header is None:
|
|
137
|
+
self.header = {}
|
|
138
|
+
if key in self.header:
|
|
139
|
+
if isinstance(self.header[key], list):
|
|
140
|
+
self.header[key].append(value)
|
|
141
|
+
else:
|
|
142
|
+
self.header[key] = [self.header[key], value]
|
|
143
|
+
else:
|
|
144
|
+
self.header[key] = [value]
|
|
145
|
+
return self
|
|
146
|
+
|
|
123
147
|
def with_x_forwarded_for(self, ip):
|
|
124
148
|
"""
|
|
125
149
|
Add and X-Forwarded-For header when necessary.
|
|
@@ -235,7 +259,7 @@ class ClientBuilder:
|
|
|
235
259
|
sender = smarty.StatusCodeSender(sender)
|
|
236
260
|
|
|
237
261
|
if self.header is not None:
|
|
238
|
-
sender = smarty.CustomHeaderSender(self.header, sender)
|
|
262
|
+
sender = smarty.CustomHeaderSender(self.header, sender, self.append_headers)
|
|
239
263
|
|
|
240
264
|
if self.custom_queries is not None:
|
|
241
265
|
sender = smarty.CustomQuerySender(self.custom_queries, sender)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
from requests import Request
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class CustomHeaderSender:
|
|
5
|
+
def __init__(self, headers, inner, append_headers=None):
|
|
6
|
+
self.headers = headers
|
|
7
|
+
self.inner = inner
|
|
8
|
+
self.append_headers = append_headers or {}
|
|
9
|
+
|
|
10
|
+
def send(self, smarty_request):
|
|
11
|
+
request = self.build_request(smarty_request)
|
|
12
|
+
return self.inner.send(request)
|
|
13
|
+
|
|
14
|
+
def build_request(self, smarty_request):
|
|
15
|
+
request = Request(url=smarty_request.url_prefix, params=smarty_request.parameters)
|
|
16
|
+
request.headers = self.apply_headers()
|
|
17
|
+
if smarty_request.payload:
|
|
18
|
+
request.data = smarty_request.payload
|
|
19
|
+
request.method = 'POST'
|
|
20
|
+
else:
|
|
21
|
+
request.method = 'GET'
|
|
22
|
+
return request
|
|
23
|
+
|
|
24
|
+
def apply_headers(self):
|
|
25
|
+
result = {}
|
|
26
|
+
for key, value in self.headers.items():
|
|
27
|
+
if key in self.append_headers:
|
|
28
|
+
separator = self.append_headers[key]
|
|
29
|
+
if isinstance(value, list):
|
|
30
|
+
result[key] = separator.join(value)
|
|
31
|
+
else:
|
|
32
|
+
result[key] = value
|
|
33
|
+
else:
|
|
34
|
+
result[key] = value
|
|
35
|
+
return result
|
|
@@ -19,3 +19,22 @@ class Analysis:
|
|
|
19
19
|
self.enhanced_match = obj.get('enhanced_match', None)
|
|
20
20
|
components_obj = obj.get("components", None)
|
|
21
21
|
self.components = ComponentAnalysis(components_obj) if components_obj else None
|
|
22
|
+
|
|
23
|
+
def to_dict(self):
|
|
24
|
+
components_dict = self.components.to_dict() if self.components else None
|
|
25
|
+
|
|
26
|
+
result = {
|
|
27
|
+
"dpv_match_code": self.dpv_match_code,
|
|
28
|
+
"dpv_footnotes": self.dpv_footnotes,
|
|
29
|
+
"dpv_cmra": self.cmra,
|
|
30
|
+
"dpv_vacant": self.vacant,
|
|
31
|
+
"active": self.active,
|
|
32
|
+
"dpv_no_stat": self.dpv_no_stat,
|
|
33
|
+
"footnotes": self.footnotes,
|
|
34
|
+
"lacslink_code": self.lacs_link_code,
|
|
35
|
+
"lacslink_indicator": self.lacs_link_indicator,
|
|
36
|
+
"suitelink_match": self.is_suite_link_match,
|
|
37
|
+
"enhanced_match": self.enhanced_match,
|
|
38
|
+
"components": components_dict or None
|
|
39
|
+
}
|
|
40
|
+
return {k: v for k, v in result.items() if v is not None}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import json
|
|
2
|
+
|
|
1
3
|
from .components import Components
|
|
2
4
|
from .metadata import Metadata
|
|
3
5
|
from .analysis import Analysis
|
|
@@ -24,3 +26,27 @@ class Candidate:
|
|
|
24
26
|
self.components = Components(obj.get('components', {}))
|
|
25
27
|
self.metadata = Metadata(obj.get('metadata', {}))
|
|
26
28
|
self.analysis = Analysis(obj.get('analysis', {}))
|
|
29
|
+
|
|
30
|
+
def to_dict(self):
|
|
31
|
+
components_dict = self.components.to_dict() if self.components else None
|
|
32
|
+
metadata_dict = self.metadata.to_dict() if self.metadata else None
|
|
33
|
+
analysis_dict = self.analysis.to_dict() if self.analysis else None
|
|
34
|
+
|
|
35
|
+
result = {
|
|
36
|
+
"input_id": self.input_id,
|
|
37
|
+
"input_index": self.input_index,
|
|
38
|
+
"candidate_index": self.candidate_index,
|
|
39
|
+
"addressee": self.addressee,
|
|
40
|
+
"delivery_line_1": self.delivery_line_1,
|
|
41
|
+
"delivery_line_2": self.delivery_line_2,
|
|
42
|
+
"last_line": self.last_line,
|
|
43
|
+
"delivery_point_barcode": self.delivery_point_barcode,
|
|
44
|
+
"smarty_key": self.smarty_key,
|
|
45
|
+
"components": components_dict or None,
|
|
46
|
+
"metadata": metadata_dict or None,
|
|
47
|
+
"analysis": analysis_dict or None
|
|
48
|
+
}
|
|
49
|
+
return {k: v for k, v in result.items() if v is not None}
|
|
50
|
+
|
|
51
|
+
def to_json(self):
|
|
52
|
+
return json.dumps(self.to_dict())
|
|
@@ -18,4 +18,23 @@ class ComponentAnalysis:
|
|
|
18
18
|
self.state_abbreviation = MatchInfo(obj['state_abbreviation']) if 'state_abbreviation' in obj else None
|
|
19
19
|
self.zipcode = MatchInfo(obj['zipcode']) if 'zipcode' in obj else None
|
|
20
20
|
self.plus4_code = MatchInfo(obj['plus4_code']) if 'plus4_code' in obj else None
|
|
21
|
-
self.urbanization = MatchInfo(obj['urbanization']) if 'urbanization' in obj else None
|
|
21
|
+
self.urbanization = MatchInfo(obj['urbanization']) if 'urbanization' in obj else None
|
|
22
|
+
|
|
23
|
+
def to_dict(self):
|
|
24
|
+
result = {
|
|
25
|
+
'primary_number': self.primary_number.to_dict() if self.primary_number else None,
|
|
26
|
+
'street_predirection': self.street_predirection.to_dict() if self.street_predirection else None,
|
|
27
|
+
'street_name': self.street_name.to_dict() if self.street_name else None,
|
|
28
|
+
'street_postdirection': self.street_postdirection.to_dict() if self.street_postdirection else None,
|
|
29
|
+
'street_suffix': self.street_suffix.to_dict() if self.street_suffix else None,
|
|
30
|
+
'secondary_number': self.secondary_number.to_dict() if self.secondary_number else None,
|
|
31
|
+
'secondary_designator': self.secondary_designator.to_dict() if self.secondary_designator else None,
|
|
32
|
+
'extra_secondary_number': self.extra_secondary_number.to_dict() if self.extra_secondary_number else None,
|
|
33
|
+
'extra_secondary_designator': self.extra_secondary_designator.to_dict() if self.extra_secondary_designator else None,
|
|
34
|
+
'city_name': self.city_name.to_dict() if self.city_name else None,
|
|
35
|
+
'state_abbreviation': self.state_abbreviation.to_dict() if self.state_abbreviation else None,
|
|
36
|
+
'zipcode': self.zipcode.to_dict() if self.zipcode else None,
|
|
37
|
+
'plus4_code': self.plus4_code.to_dict() if self.plus4_code else None,
|
|
38
|
+
'urbanization': self.urbanization.to_dict() if self.urbanization else None,
|
|
39
|
+
}
|
|
40
|
+
return {k: v for k, v in result.items() if v is not None}
|
|
@@ -24,3 +24,27 @@ class Components:
|
|
|
24
24
|
self.plus4_code = obj.get('plus4_code', None)
|
|
25
25
|
self.delivery_point = obj.get('delivery_point', None)
|
|
26
26
|
self.delivery_point_check_digit = obj.get('delivery_point_check_digit', None)
|
|
27
|
+
|
|
28
|
+
def to_dict(self):
|
|
29
|
+
result = {
|
|
30
|
+
"urbanization": self.urbanization,
|
|
31
|
+
"primary_number": self.primary_number,
|
|
32
|
+
"street_name": self.street_name,
|
|
33
|
+
"street_predirection": self.street_predirection,
|
|
34
|
+
"street_postdirection": self.street_postdirection,
|
|
35
|
+
"street_suffix": self.street_suffix,
|
|
36
|
+
"secondary_number": self.secondary_number,
|
|
37
|
+
"secondary_designator": self.secondary_designator,
|
|
38
|
+
"extra_secondary_number": self.extra_secondary_number,
|
|
39
|
+
"extra_secondary_designator": self.extra_secondary_designator,
|
|
40
|
+
"pmb_designator": self.pmb_designator,
|
|
41
|
+
"pmb_number": self.pmb_number,
|
|
42
|
+
"city_name": self.city_name,
|
|
43
|
+
"default_city_name": self.default_city_name,
|
|
44
|
+
"state_abbreviation": self.state_abbreviation,
|
|
45
|
+
"zipcode": self.zipcode,
|
|
46
|
+
"plus4_code": self.plus4_code,
|
|
47
|
+
"delivery_point": self.delivery_point,
|
|
48
|
+
"delivery_point_check_digit": self.delivery_point_check_digit
|
|
49
|
+
}
|
|
50
|
+
return {k: v for k, v in result.items() if v is not None}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from smartystreets_python_sdk.us_street.match_type import MatchType
|
|
2
2
|
from smartystreets_python_sdk.us_street.output_format import OutputFormat
|
|
3
|
+
import json
|
|
3
4
|
|
|
4
5
|
|
|
5
6
|
class Lookup:
|
|
@@ -31,3 +32,27 @@ class Lookup:
|
|
|
31
32
|
|
|
32
33
|
def add_custom_parameter(self, parameter, value):
|
|
33
34
|
self.custom_parameter_array[parameter] = value
|
|
35
|
+
|
|
36
|
+
def to_dict(self):
|
|
37
|
+
result = {
|
|
38
|
+
"input_id": self.input_id,
|
|
39
|
+
"street": self.street,
|
|
40
|
+
"street2": self.street2,
|
|
41
|
+
"secondary": self.secondary,
|
|
42
|
+
"city": self.city,
|
|
43
|
+
"state": self.state,
|
|
44
|
+
"zipcode": self.zipcode,
|
|
45
|
+
"lastline": self.lastline,
|
|
46
|
+
"addressee": self.addressee,
|
|
47
|
+
"urbanization": self.urbanization,
|
|
48
|
+
"match": self.match,
|
|
49
|
+
"candidates": self.candidates,
|
|
50
|
+
"outputformat": self.outputformat,
|
|
51
|
+
"county_source": self.county_source,
|
|
52
|
+
"result": [candidate.to_dict() for candidate in self.result],
|
|
53
|
+
"custom_parameter_array": self.custom_parameter_array
|
|
54
|
+
}
|
|
55
|
+
return {k: v for k, v in result.items() if v is not None}
|
|
56
|
+
|
|
57
|
+
def to_json(self):
|
|
58
|
+
return json.dumps(self.to_dict())
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
class MatchInfo:
|
|
2
|
+
def __init__(self, obj):
|
|
3
|
+
"""
|
|
4
|
+
Holds matching status and change information for an address component.
|
|
5
|
+
"""
|
|
6
|
+
self.status = obj.get('status', None)
|
|
7
|
+
self.change = obj.get('change', None)
|
|
8
|
+
|
|
9
|
+
def to_dict(self):
|
|
10
|
+
result = {
|
|
11
|
+
"status": self.status,
|
|
12
|
+
"change": self.change
|
|
13
|
+
}
|
|
14
|
+
return {k: v for k, v in result.items() if v is not None}
|
|
@@ -21,3 +21,26 @@ class Metadata:
|
|
|
21
21
|
self.utc_offset = obj.get('utc_offset', None)
|
|
22
22
|
self.obeys_dst = obj.get('dst', None)
|
|
23
23
|
self.is_ews_match = obj.get('ews_match', None)
|
|
24
|
+
|
|
25
|
+
def to_dict(self):
|
|
26
|
+
result = {
|
|
27
|
+
"record_type": self.record_type,
|
|
28
|
+
"zip_type": self.zip_type,
|
|
29
|
+
"county_fips": self.county_fips,
|
|
30
|
+
"county_name": self.county_name,
|
|
31
|
+
"carrier_route": self.carrier_route,
|
|
32
|
+
"congressional_district": self.congressional_district,
|
|
33
|
+
"building_default_indicator": self.building_default_indicator,
|
|
34
|
+
"rdi": self.rdi,
|
|
35
|
+
"elot_sequence": self.elot_sequence,
|
|
36
|
+
"elot_sort": self.elot_sort,
|
|
37
|
+
"latitude": self.latitude,
|
|
38
|
+
"longitude": self.longitude,
|
|
39
|
+
"coordinate_license": self.coordinate_license,
|
|
40
|
+
"precision": self.precision,
|
|
41
|
+
"time_zone": self.time_zone,
|
|
42
|
+
"utc_offset": self.utc_offset,
|
|
43
|
+
"dst": self.obeys_dst,
|
|
44
|
+
"ews_match": self.is_ews_match
|
|
45
|
+
}
|
|
46
|
+
return {k: v for k, v in result.items() if v is not None}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: smartystreets_python_sdk
|
|
3
|
-
Version: 5.
|
|
3
|
+
Version: 5.2.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.
|
|
6
|
+
Download-URL: https://github.com/smartystreets/smartystreets-python-sdk/tarball/5.2.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.
|
|
2
|
+
__version__="5.2.0"
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
from requests import Request
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
class CustomHeaderSender:
|
|
5
|
-
def __init__(self, headers, inner):
|
|
6
|
-
self.headers = headers
|
|
7
|
-
self.inner = inner
|
|
8
|
-
|
|
9
|
-
def send(self, smarty_request):
|
|
10
|
-
request = self.build_request(smarty_request)
|
|
11
|
-
return self.inner.send(request)
|
|
12
|
-
|
|
13
|
-
def build_request(self, smarty_request):
|
|
14
|
-
request = Request(url=smarty_request.url_prefix, params=smarty_request.parameters)
|
|
15
|
-
request.headers = self.headers
|
|
16
|
-
if smarty_request.payload:
|
|
17
|
-
request.data = smarty_request.payload
|
|
18
|
-
request.method = 'POST'
|
|
19
|
-
else:
|
|
20
|
-
request.method = 'GET'
|
|
21
|
-
return request
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/batch.py
RENAMED
|
File without changes
|
|
File without changes
|
{smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/errors.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{smartystreets_python_sdk-5.0.0 → smartystreets_python_sdk-5.2.0}/smartystreets_python_sdk/proxy.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|