diff --git a/CLAUDE.md b/CLAUDE.md index bba3253..8233092 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -76,6 +76,7 @@ Each API service follows a consistent structure under `smartystreets_python_sdk/ Three credential types in `smartystreets_python_sdk/`, all implementing `sign(request)`: - `StaticCredentials` - Server-to-server (auth_id + auth_token as query params) - `SharedCredentials` - Client-side/embedded (API key + hostname via referer) +- Embedded/website keys are GET-only — not valid for batch (POST) requests or the US Extract API (POST-only): https://www.smarty.com/docs/cloud/authentication - `BasicAuthCredentials` - HTTP Basic Auth (sets `request.auth` tuple) ### Header Handling diff --git a/examples/us_extract_example.py b/examples/us_extract_example.py index 748b717..3985ba0 100644 --- a/examples/us_extract_example.py +++ b/examples/us_extract_example.py @@ -1,22 +1,15 @@ import os -from smartystreets_python_sdk import SharedCredentials, BasicAuthCredentials, ClientBuilder +from smartystreets_python_sdk import BasicAuthCredentials, ClientBuilder from smartystreets_python_sdk.us_extract import Lookup as ExtractLookup from smartystreets_python_sdk.us_street.match_type import MatchType def run(): - # key = "Your SmartyStreets Key here" - # hostname = "Your Hostname here" - # We recommend storing your secret keys in environment variables instead---it's safer! - # for client-side requests (browser/mobile), use this code: - # key = os.environ['SMARTY_AUTH_WEB'] - # hostname = os.environ['SMARTY_WEBSITE_DOMAIN'] # - # credentials = SharedCredentials(key, hostname) - - # for server-to-server requests, use this code: + # The US Extract API is POST-only and embedded keys are restricted to GET, so this + # API requires secret keys: https://www.smarty.com/docs/cloud/authentication auth_id = os.environ['SMARTY_AUTH_ID'] auth_token = os.environ['SMARTY_AUTH_TOKEN'] diff --git a/examples/us_street_multiple_addresses_example.py b/examples/us_street_multiple_addresses_example.py index c9cc391..7715cc6 100644 --- a/examples/us_street_multiple_addresses_example.py +++ b/examples/us_street_multiple_addresses_example.py @@ -1,22 +1,15 @@ import os -from smartystreets_python_sdk import SharedCredentials, BasicAuthCredentials, exceptions, Batch, ClientBuilder +from smartystreets_python_sdk import BasicAuthCredentials, exceptions, Batch, ClientBuilder from smartystreets_python_sdk.us_street import Lookup as StreetLookup from smartystreets_python_sdk.us_street.match_type import MatchType def run(): - # key = "Your SmartyStreets Key here" - # hostname = "Your Hostname here" - # We recommend storing your secret keys in environment variables instead---it's safer! - # for client-side requests (browser/mobile), use this code: - # key = os.environ['SMARTY_AUTH_WEB'] - # hostname = os.environ['SMARTY_WEBSITE_DOMAIN'] # - # credentials = SharedCredentials(key, hostname) - - # for server-to-server requests, use this code: + # Batch requests are sent via HTTP POST. Embedded keys are restricted to GET, so + # batches require secret keys: https://www.smarty.com/docs/cloud/authentication auth_id = os.environ['SMARTY_AUTH_ID'] auth_token = os.environ['SMARTY_AUTH_TOKEN'] diff --git a/examples/us_zipcode_multiple_lookups_example.py b/examples/us_zipcode_multiple_lookups_example.py index 491d602..91c49da 100644 --- a/examples/us_zipcode_multiple_lookups_example.py +++ b/examples/us_zipcode_multiple_lookups_example.py @@ -1,21 +1,14 @@ import os -from smartystreets_python_sdk import SharedCredentials, BasicAuthCredentials, exceptions, Batch, ClientBuilder +from smartystreets_python_sdk import BasicAuthCredentials, exceptions, Batch, ClientBuilder from smartystreets_python_sdk.us_zipcode import Lookup as ZIPCodeLookup def run(): - # key = "Your SmartyStreets Key here" - # hostname = "Your Hostname here" - # We recommend storing your secret keys in environment variables instead---it's safer! - # for client-side requests (browser/mobile), use this code: - # key = os.environ['SMARTY_AUTH_WEB'] - # hostname = os.environ['SMARTY_WEBSITE_DOMAIN'] # - # credentials = SharedCredentials(key, hostname) - - # for server-to-server requests, use this code: + # Batch requests are sent via HTTP POST. Embedded keys are restricted to GET, so + # batches require secret keys: https://www.smarty.com/docs/cloud/authentication auth_id = os.environ['SMARTY_AUTH_ID'] auth_token = os.environ['SMARTY_AUTH_TOKEN']