Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 3 additions & 10 deletions examples/us_extract_example.py
Original file line number Diff line number Diff line change
@@ -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']

Expand Down
13 changes: 3 additions & 10 deletions examples/us_street_multiple_addresses_example.py
Original file line number Diff line number Diff line change
@@ -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']

Expand Down
13 changes: 3 additions & 10 deletions examples/us_zipcode_multiple_lookups_example.py
Original file line number Diff line number Diff line change
@@ -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']

Expand Down