CLI and Python client for the US State Department SDTA Affairs Data API
Project description
sdta
Python CLI and client for the US State Department SDTA Affairs Data API.
Query live travel advisories, full country travel information, and field-level data — straight from the official State Department source, no key required.
Install
pip install sdta
Or from source:
git clone https://github.com/Aureum01/sdta
cd sdta
pip install -e .
CLI
advisory — Travel advisory level for a country
sdta advisory AR
sdta advisory France
sdta advisory MX --json
Output:
Argentina (AR)
Level 2 — Exercise Increased Caution
Exercise increased caution in Argentina due to crime.
Last Updated: March 11, 2025
advisories — All current advisories
sdta advisories
sdta advisories --level 4 # Do Not Travel countries only
sdta advisories --level 3 # Reconsider Travel
sdta advisories --level 4 --json
Sorted highest-risk first. Level meanings:
| Level | Label |
|---|---|
| 1 | Normal |
| 2 | Exercise Increased Caution |
| 3 | Reconsider Travel |
| 4 | Do Not Travel |
info — Full travel information for a country
sdta info MX # all sections, formatted
sdta info MX --field safety_and_security # single section, plain text
sdta info MX --json # full record as JSON
Available --field values:
destination_description
entry_exit_requirements
health
local_laws_and_special_circumstances
safety_and_security
travel_embassyAndConsulate
travel_transportation
field — Single field, targeted fetch
Uses the per-field endpoint — lighter than fetching the full record when you only need one section.
sdta field AR health
sdta field AR health --html # raw HTML
sdta field AR health --json # both html + text variants
debug — Raw API response
Prints the raw JSON from the API. Useful for inspecting the response shape or diagnosing data issues.
sdta debug FR
Python API
All modules are usable directly without the CLI.
Advisory for a single country
from state_department.travel_advisory_by_country import fetch
advisory = fetch("AR")
print(advisory.country_name) # Argentina
print(advisory.advisory_level) # 2
print(advisory.advisory_message) # Exercise increased caution...
All advisories
from state_department.travel_advisories_all import fetch
advisories = fetch()
level4 = [a for a in advisories if a.advisory_level == 4]
Full country travel info
from state_department.country_travel_info_by_country import fetch, CountryTravelInfo
info: CountryTravelInfo = fetch("MX")
print(info.safety_and_security_text)
print(info.health_text)
print(info.entry_exit_requirements_text)
Single field
from state_department.country_travel_info_field import fetch, FieldResult
result: FieldResult = fetch("AR", "health")
print(result.text) # plain text
print(result.html) # raw HTML
Data Source
All data is fetched live from the US State Department SDTA Affairs Data API:
https://cadataapi.state.gov/api/
No API key required. No rate limits documented. Data reflects the live State Department website.
Country codes used throughout are the State Department's internal 2-letter tags (mostly matching ISO 3166-1 alpha-2, with some exceptions). See state_department/state_dept_client.py for the full list.
Modules
| Module | Endpoint | Description |
|---|---|---|
travel_advisory_by_country |
/api/TravelAdvisory/{tag} |
Advisory level + message for one country |
travel_advisories_all |
/api/TravelAdvisory |
All current advisories |
country_travel_info_by_country |
/api/CountryTravelInformation/{tag} |
Full travel info record |
country_travel_info_field |
/api/CountryTravelInformation/{tag}/{field} |
Single field from a travel info record |
state_dept_client |
— | Shared HTTP client, country code utilities |
debug_response |
— | Raw response dump for any endpoint |
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sdta-0.1.0.tar.gz.
File metadata
- Download URL: sdta-0.1.0.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
27b9c525bbc528190badf0e0052728f08485f2347efd02e0cb3fd60ed5b8be77
|
|
| MD5 |
6a70f8005f53e7c4710a04373c224573
|
|
| BLAKE2b-256 |
218dfecf760212ede3cad5154a0fe4b941cd93b8d0f16592b56290f766610bc7
|
File details
Details for the file sdta-0.1.0-py3-none-any.whl.
File metadata
- Download URL: sdta-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c81456cb8dd6e06f534c181dad6292a06edf19d4f250265f63354e50243a632
|
|
| MD5 |
dfe6ab0e8c7d926b161017d1e5380f27
|
|
| BLAKE2b-256 |
0ede34f21107dd0cd31a455e7c0ed287c77977168637e433ee1c4e93cb013d7c
|