Skip to main content

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

Metadata

Release files for sdta 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sdta 0.1.0
File Size Uploaded Provenance
sdta-0.1.0.tar.gz 3.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for sdta 0.1.0
File Interpreter ABI Platform
sdta-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 6.1 kB

Release files / sdta-0.1.0.tar.gz

Download URL sdta-0.1.0.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
27b9c525bbc528190badf0e0052728f08485f2347efd02e0cb3fd60ed5b8be77
BLAKE2b-256 checksum
How to use checksums
218dfecf760212ede3cad5154a0fe4b941cd93b8d0f16592b56290f766610bc7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / sdta-0.1.0-py3-none-any.whl

Download URL sdta-0.1.0-py3-none-any.whl
Size 3.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5c81456cb8dd6e06f534c181dad6292a06edf19d4f250265f63354e50243a632
BLAKE2b-256 checksum
How to use checksums
0ede34f21107dd0cd31a455e7c0ed287c77977168637e433ee1c4e93cb013d7c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Security for sdta 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page