smartystreets-python-sdk 7.0.0__tar.gz → 7.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.
Files changed (100) hide show
  1. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/PKG-INFO +2 -2
  2. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/client_builder.py +6 -0
  3. smartystreets_python_sdk-7.2.0/smartystreets_python_sdk/us_autocomplete/client.py +70 -0
  4. smartystreets_python_sdk-7.2.0/smartystreets_python_sdk/us_autocomplete/lookup.py +83 -0
  5. smartystreets_python_sdk-7.2.0/smartystreets_python_sdk/us_autocomplete/suggestion.py +15 -0
  6. smartystreets_python_sdk-7.2.0/smartystreets_python_sdk/us_autocomplete_pro/__init__.py +4 -0
  7. smartystreets_python_sdk-7.2.0/smartystreets_python_sdk/us_autocomplete_pro/geolocation_type.py +3 -0
  8. smartystreets_python_sdk-7.2.0/smartystreets_python_sdk/us_reverse_geo/source.py +6 -0
  9. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk.egg-info/PKG-INFO +2 -2
  10. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk.egg-info/SOURCES.txt +6 -0
  11. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk_version/__init__.py +1 -1
  12. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/LICENSE.md +0 -0
  13. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/README.md +0 -0
  14. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/setup.cfg +0 -0
  15. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/setup.py +0 -0
  16. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/__init__.py +0 -0
  17. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/basic_auth_credentials.py +0 -0
  18. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/batch.py +0 -0
  19. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/custom_header_sender.py +0 -0
  20. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/custom_query_sender.py +0 -0
  21. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/errors.py +0 -0
  22. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/exceptions.py +0 -0
  23. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/international_autocomplete/__init__.py +0 -0
  24. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/international_autocomplete/candidate.py +0 -0
  25. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/international_autocomplete/client.py +0 -0
  26. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/international_autocomplete/lookup.py +0 -0
  27. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/international_postal_code/__init__.py +0 -0
  28. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/international_postal_code/candidate.py +0 -0
  29. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/international_postal_code/client.py +0 -0
  30. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/international_postal_code/lookup.py +0 -0
  31. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/international_street/__init__.py +0 -0
  32. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/international_street/analysis.py +0 -0
  33. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/international_street/candidate.py +0 -0
  34. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/international_street/changes.py +0 -0
  35. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/international_street/client.py +0 -0
  36. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/international_street/components.py +0 -0
  37. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/international_street/language_mode.py +0 -0
  38. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/international_street/lookup.py +0 -0
  39. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/international_street/metadata.py +0 -0
  40. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/international_street/rootlevel.py +0 -0
  41. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/license_sender.py +0 -0
  42. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/native_serializer.py +0 -0
  43. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/proxy.py +0 -0
  44. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/request.py +0 -0
  45. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/requests_sender.py +0 -0
  46. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/response.py +0 -0
  47. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/retry_sender.py +0 -0
  48. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/shared_credentials.py +0 -0
  49. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/signing_sender.py +0 -0
  50. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/static_credentials.py +0 -0
  51. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/status_code_sender.py +0 -0
  52. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/url_prefix_sender.py +0 -0
  53. {smartystreets_python_sdk-7.0.0/smartystreets_python_sdk/us_autocomplete_pro → smartystreets_python_sdk-7.2.0/smartystreets_python_sdk/us_autocomplete}/__init__.py +0 -0
  54. {smartystreets_python_sdk-7.0.0/smartystreets_python_sdk/us_autocomplete_pro → smartystreets_python_sdk-7.2.0/smartystreets_python_sdk/us_autocomplete}/geolocation_type.py +0 -0
  55. {smartystreets_python_sdk-7.0.0/smartystreets_python_sdk/us_autocomplete_pro → smartystreets_python_sdk-7.2.0/smartystreets_python_sdk/us_autocomplete}/source.py +0 -0
  56. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/us_autocomplete_pro/client.py +0 -0
  57. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/us_autocomplete_pro/lookup.py +0 -0
  58. {smartystreets_python_sdk-7.0.0/smartystreets_python_sdk/us_reverse_geo → smartystreets_python_sdk-7.2.0/smartystreets_python_sdk/us_autocomplete_pro}/source.py +0 -0
  59. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/us_autocomplete_pro/suggestion.py +0 -0
  60. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/us_enrichment/__init__.py +0 -0
  61. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/us_enrichment/business/__init__.py +0 -0
  62. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/us_enrichment/business/detail.py +0 -0
  63. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/us_enrichment/business/summary.py +0 -0
  64. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/us_enrichment/client.py +0 -0
  65. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/us_enrichment/lookup.py +0 -0
  66. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/us_enrichment/response.py +0 -0
  67. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/us_extract/__init__.py +0 -0
  68. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/us_extract/address.py +0 -0
  69. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/us_extract/client.py +0 -0
  70. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/us_extract/lookup.py +0 -0
  71. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/us_extract/metadata.py +0 -0
  72. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/us_extract/result.py +0 -0
  73. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/us_reverse_geo/__init__.py +0 -0
  74. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/us_reverse_geo/address.py +0 -0
  75. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/us_reverse_geo/client.py +0 -0
  76. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/us_reverse_geo/coordinate.py +0 -0
  77. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/us_reverse_geo/lookup.py +0 -0
  78. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/us_reverse_geo/response.py +0 -0
  79. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/us_reverse_geo/result.py +0 -0
  80. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/us_street/__init__.py +0 -0
  81. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/us_street/analysis.py +0 -0
  82. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/us_street/candidate.py +0 -0
  83. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/us_street/client.py +0 -0
  84. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/us_street/component_analysis.py +0 -0
  85. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/us_street/components.py +0 -0
  86. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/us_street/lookup.py +0 -0
  87. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/us_street/match_info.py +0 -0
  88. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/us_street/match_type.py +0 -0
  89. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/us_street/metadata.py +0 -0
  90. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/us_street/output_format.py +0 -0
  91. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/us_zipcode/__init__.py +0 -0
  92. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/us_zipcode/alternate_county.py +0 -0
  93. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/us_zipcode/city.py +0 -0
  94. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/us_zipcode/client.py +0 -0
  95. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/us_zipcode/lookup.py +0 -0
  96. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/us_zipcode/result.py +0 -0
  97. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk/us_zipcode/zipcode.py +0 -0
  98. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk.egg-info/dependency_links.txt +0 -0
  99. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.2.0}/smartystreets_python_sdk.egg-info/requires.txt +0 -0
  100. {smartystreets_python_sdk-7.0.0 → smartystreets_python_sdk-7.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: 7.0.0
3
+ Version: 7.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/7.0.0
6
+ Download-URL: https://github.com/smartystreets/smartystreets-python-sdk/tarball/7.2.0
7
7
  Author: SmartyStreets SDK Team
8
8
  Author-email: support@smartystreets.com
9
9
  License: Apache 2
@@ -3,6 +3,7 @@ from smartystreets_python_sdk.us_street import Client as USStreetClient
3
3
  from smartystreets_python_sdk.us_zipcode import Client as USZIPClient
4
4
  from smartystreets_python_sdk.us_extract import Client as USExtractClient
5
5
  from smartystreets_python_sdk.us_autocomplete_pro import Client as USAutocompleteProClient
6
+ from smartystreets_python_sdk.us_autocomplete import Client as USAutocompleteClient
6
7
  from smartystreets_python_sdk.us_reverse_geo import Client as USReverseGeoClient
7
8
  from smartystreets_python_sdk.international_street import Client as InternationalStreetClient
8
9
  from smartystreets_python_sdk.international_autocomplete import Client as InternationalAutocompleteClient
@@ -34,6 +35,7 @@ class ClientBuilder:
34
35
  self.INTERNATIONAL_STREET_API_URL = "https://international-street.api.smarty.com/verify"
35
36
  self.INTERNATIONAL_AUTOCOMPLETE_API_URL = "https://international-autocomplete.api.smarty.com/v2/lookup"
36
37
  self.US_AUTOCOMPLETE_PRO_API_URL = "https://us-autocomplete-pro.api.smarty.com/lookup"
38
+ self.US_AUTOCOMPLETE_API_URL = "https://us-autocomplete.api.smarty.com/v2/lookup"
37
39
  self.US_EXTRACT_API_URL = "https://us-extract.api.smarty.com"
38
40
  self.US_STREET_API_URL = "https://us-street.api.smarty.com/street-address"
39
41
  self.US_ZIP_CODE_API_URL = "https://us-zipcode.api.smarty.com/lookup"
@@ -229,6 +231,10 @@ class ClientBuilder:
229
231
  self.ensure_url_prefix_not_null(self.US_AUTOCOMPLETE_PRO_API_URL)
230
232
  return USAutocompleteProClient(self.build_sender(), self.serializer)
231
233
 
234
+ def build_us_autocomplete_api_client(self):
235
+ self.ensure_url_prefix_not_null(self.US_AUTOCOMPLETE_API_URL)
236
+ return USAutocompleteClient(self.build_sender(), self.serializer)
237
+
232
238
  def build_us_extract_api_client(self):
233
239
  self.ensure_url_prefix_not_null(self.US_EXTRACT_API_URL)
234
240
  return USExtractClient(self.build_sender(), self.serializer)
@@ -0,0 +1,70 @@
1
+ from enum import Enum
2
+
3
+ from smartystreets_python_sdk import Request
4
+ from smartystreets_python_sdk.exceptions import SmartyException
5
+ from smartystreets_python_sdk.us_autocomplete import Suggestion, geolocation_type
6
+
7
+
8
+ class Client:
9
+ def __init__(self, sender, serializer):
10
+ """
11
+ It is recommended to instantiate this class using ClientBuilder.build_us_autocomplete_api_client()
12
+ """
13
+ self.sender = sender
14
+ self.serializer = serializer
15
+
16
+ def send(self, lookup):
17
+ """
18
+ Sends a Lookup object to the US Autocomplete API and stores the result in the Lookup's result field.
19
+ """
20
+ if not lookup or not lookup.search:
21
+ raise SmartyException('Send() must be passed a Lookup with the search field set.')
22
+
23
+ request = self.build_request(lookup)
24
+
25
+ response = self.sender.send(request)
26
+
27
+ if response.error:
28
+ raise response.error
29
+
30
+ result = self.serializer.deserialize(response.payload)
31
+ suggestions = self.convert_suggestions(result.get('suggestions') or [])
32
+ lookup.result = suggestions
33
+
34
+ return suggestions
35
+
36
+ def build_request(self, lookup):
37
+ request = Request()
38
+
39
+ self.add_parameter(request, 'search', lookup.search)
40
+ self.add_parameter(request, 'max_results', lookup.max_results)
41
+ self.add_parameter(request, 'include_only_cities', self.build_filter_string(lookup.city_filter))
42
+ self.add_parameter(request, 'include_only_states', self.build_filter_string(lookup.state_filter))
43
+ self.add_parameter(request, 'include_only_zip_codes', self.build_filter_string(lookup.zip_filter))
44
+ self.add_parameter(request, 'exclude_states', self.build_filter_string(lookup.exclude_states))
45
+ self.add_parameter(request, 'prefer_cities', self.build_filter_string(lookup.prefer_cities))
46
+ self.add_parameter(request, 'prefer_states', self.build_filter_string(lookup.prefer_states))
47
+ self.add_parameter(request, 'prefer_zip_codes', self.build_filter_string(lookup.prefer_zips))
48
+ self.add_parameter(request, 'prefer_ratio', lookup.prefer_ratio)
49
+ self.add_parameter(request, 'prefer_geolocation', lookup.prefer_geolocation)
50
+ self.add_parameter(request, 'source', lookup.source)
51
+ self.add_parameter(request, 'selected', lookup.selected)
52
+ self.add_parameter(request, 'exclude', self.build_filter_string(lookup.exclude, ','))
53
+
54
+ for parameter in lookup.custom_parameter_array:
55
+ self.add_parameter(request, parameter, lookup.custom_parameter_array[parameter])
56
+
57
+ return request
58
+
59
+ @staticmethod
60
+ def build_filter_string(filter_list, separator=';'):
61
+ return separator.join(filter_list or []) or None
62
+
63
+ @staticmethod
64
+ def convert_suggestions(suggestion_dictionaries):
65
+ return [Suggestion(suggestion) for suggestion in suggestion_dictionaries]
66
+
67
+ @staticmethod
68
+ def add_parameter(request, key, value):
69
+ if value and value != 'none':
70
+ request.parameters[key] = value.value if isinstance(value, Enum) else value
@@ -0,0 +1,83 @@
1
+ from smartystreets_python_sdk.us_autocomplete import geolocation_type
2
+
3
+
4
+ class Lookup:
5
+ def __init__(self, search=None, max_results=None, city_filter=None, state_filter=None, zip_filter=None,
6
+ exclude_states=None, prefer_cities=None, prefer_states=None, prefer_zips=None, prefer_ratio=None,
7
+ prefer_geolocation=None, selected=None, exclude=None, source=None):
8
+
9
+ """
10
+ In addition to holding all of the input data for this lookup, this class also will contain the result
11
+ of the lookup after it comes back from the API.
12
+
13
+ See "https://www.smarty.com/docs/apis/us-autocomplete-v2/reference#http-request-input-fields"
14
+
15
+ :param search: The part of the address that has already been typed (required)
16
+ :param max_results: Maximum number of address suggestions to return
17
+ :param city_filter: Limit the results to only those cities listed, as well as those in state_filter
18
+ :param state_filter: Limit the results to only those states listed, as well as those in city_filter
19
+ :param zip_filter: Limit the result to only those ZIP Codes listed. When this parameter is used,
20
+ no other _cities, _states parameters can be used
21
+ :param exclude_states: Exclude the following states from the results. When this parameter is used,
22
+ no other include_ parameters can be used
23
+ :param prefer_cities: Display suggestions with the listed cities and states at the top of the suggestion list
24
+ :param prefer_states: Display suggestions with the listed states at the top of the suggestion list
25
+ :param prefer_zips: Display suggestions with the listed ZIP Codes at the top of the suggestion list.
26
+ When this parameter is used, no other _cities or _state parameters can be used
27
+ :param prefer_ratio: Specifies the percentage of address suggestions that should be preferred
28
+ and will appear at the top of the suggestion list
29
+ :param prefer_geolocation: If omitted or set to city it uses the sender's IP address to determine location,
30
+ then automatically adds the city and state to the prefer_cities value.
31
+ This parameter takes precedence over other _include or exclude parameters,
32
+ meaning that if it is not set to none, you may see addresses from the customer's area
33
+ when you may not desire it
34
+ :param selected: Used by UI components to request a list of secondaries (up to 100) for the specified address
35
+ :param exclude: Removes the given partial address from the suggestion results
36
+ :param source: Include results from alternate data sources. Defaults to None (API default: postal).
37
+ Use Source.ALL to include non-postal addresses, Source.POSTAL to limit to postal only.
38
+ """
39
+ self.result = []
40
+ self.custom_parameter_array = {}
41
+ self.search = search
42
+ self.max_results = max_results
43
+ self.city_filter = city_filter or []
44
+ self.state_filter = state_filter or []
45
+ self.zip_filter = zip_filter or []
46
+ self.exclude_states = exclude_states or []
47
+ self.prefer_cities = prefer_cities or []
48
+ self.prefer_states = prefer_states or []
49
+ self.prefer_zips = prefer_zips or []
50
+ self.prefer_ratio = prefer_ratio
51
+ self.prefer_geolocation = prefer_geolocation
52
+ self.selected = selected
53
+ self.exclude = exclude or []
54
+ self.source = source
55
+
56
+ def add_city_filter(self, city):
57
+ self.city_filter.append(city)
58
+
59
+ def add_state_filter(self, state):
60
+ self.state_filter.append(state)
61
+
62
+ def add_zip_filter(self, zipcode):
63
+ self.prefer_geolocation = geolocation_type.NONE
64
+ self.zip_filter.append(zipcode)
65
+
66
+ def add_state_exclusion(self, state):
67
+ self.exclude_states.append(state)
68
+
69
+ def add_city_preference(self, city):
70
+ self.prefer_cities.append(city)
71
+
72
+ def add_state_preference(self, state):
73
+ self.prefer_states.append(state)
74
+
75
+ def add_zip_preference(self, zipcode):
76
+ self.prefer_geolocation = geolocation_type.NONE
77
+ self.prefer_zips.append(zipcode)
78
+
79
+ def add_exclude(self, exclude_type):
80
+ self.exclude.append(exclude_type)
81
+
82
+ def add_custom_parameter(self, parameter, value):
83
+ self.custom_parameter_array[parameter] = value
@@ -0,0 +1,15 @@
1
+ class Suggestion:
2
+ def __init__(self, obj=None):
3
+ """
4
+ See "https://www.smarty.com/docs/apis/us-autocomplete-v2/reference#http-response-status"
5
+ """
6
+ self.smarty_key = obj.get('smarty_key', None)
7
+ self.entry_id = obj.get('entry_id', None)
8
+ self.urbanization = obj.get('urbanization', None)
9
+ self.street_line = obj.get('street_line', None)
10
+ self.secondary = obj.get('secondary', None)
11
+ self.city = obj.get('city', None)
12
+ self.state = obj.get('state', None)
13
+ self.zipcode = obj.get('zipcode', None)
14
+ self.entries = obj.get('entries', None)
15
+ self.source = obj.get('source', None)
@@ -0,0 +1,4 @@
1
+ from .suggestion import Suggestion
2
+ from .lookup import Lookup
3
+ from .client import Client
4
+ from .source import Source
@@ -0,0 +1,6 @@
1
+ from enum import Enum
2
+
3
+
4
+ class Source(str, Enum):
5
+ ALL = "all"
6
+ POSTAL = "postal"
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: smartystreets_python_sdk
3
- Version: 7.0.0
3
+ Version: 7.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/7.0.0
6
+ Download-URL: https://github.com/smartystreets/smartystreets-python-sdk/tarball/7.2.0
7
7
  Author: SmartyStreets SDK Team
8
8
  Author-email: support@smartystreets.com
9
9
  License: Apache 2
@@ -45,6 +45,12 @@ smartystreets_python_sdk/international_street/language_mode.py
45
45
  smartystreets_python_sdk/international_street/lookup.py
46
46
  smartystreets_python_sdk/international_street/metadata.py
47
47
  smartystreets_python_sdk/international_street/rootlevel.py
48
+ smartystreets_python_sdk/us_autocomplete/__init__.py
49
+ smartystreets_python_sdk/us_autocomplete/client.py
50
+ smartystreets_python_sdk/us_autocomplete/geolocation_type.py
51
+ smartystreets_python_sdk/us_autocomplete/lookup.py
52
+ smartystreets_python_sdk/us_autocomplete/source.py
53
+ smartystreets_python_sdk/us_autocomplete/suggestion.py
48
54
  smartystreets_python_sdk/us_autocomplete_pro/__init__.py
49
55
  smartystreets_python_sdk/us_autocomplete_pro/client.py
50
56
  smartystreets_python_sdk/us_autocomplete_pro/geolocation_type.py
@@ -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__="7.0.0"
2
+ __version__="7.2.0"