{"id":6885,"library":"sodapy","title":"sodapy: Python client for Socrata Open Data API","description":"sodapy is a Python client for the Socrata Open Data API (SODA), enabling programmatic access to datasets from Socrata-powered platforms. While the library is functional, it has been unmaintained since August 31, 2022, with no new features or bug fixes planned. The current version is 2.2.0, and it is compatible with Python 3.5-3.10.","status":"deprecated","version":"2.2.0","language":"en","source_language":"en","source_url":"https://github.com/xmunoz/sodapy","tags":["socrata","open data","api","data retrieval"],"install":[{"cmd":"pip install sodapy","lang":"bash","label":"Install with pip"}],"dependencies":[{"reason":"Core dependency for HTTP requests.","package":"requests","optional":false}],"imports":[{"symbol":"Socrata","correct":"from sodapy import Socrata"}],"quickstart":{"code":"import os\nfrom sodapy import Socrata\n\n# Get credentials from environment variables or provide directly\nAPP_TOKEN = os.environ.get('SOCRATA_APP_TOKEN', None) # Recommended for higher rate limits\nUSERNAME = os.environ.get('SOCRATA_USERNAME', None) # Only required for creating/modifying data\nPASSWORD = os.environ.get('SOCRATA_PASSWORD', None) # Only required for creating/modifying data\n\n# Example: Connect to a public dataset (e.g., NYC Open Data - 311 Service Requests)\n# Replace 'data.cityofnewyork.us' with your Socrata domain\n# Replace 'erm2-nwe9' with your dataset identifier\ndomain = 'data.cityofnewyork.us'\ndataset_identifier = 'erm2-nwe9'\n\nwith Socrata(domain, APP_TOKEN, username=USERNAME, password=PASSWORD) as client:\n    # Increase timeout for large datasets if needed\n    # client.timeout = 50\n\n    # Example: Retrieve the first 5 records\n    print(f\"Retrieving the first 5 records from {dataset_identifier} on {domain}...\")\n    results = client.get(dataset_identifier, limit=5)\n\n    # Results are returned as a list of dictionaries\n    for item in results:\n        print(item)\n\n    print(f\"\\nRetrieved {len(results)} records.\")\n\n    # Example: Retrieve metadata for the dataset\n    print(f\"\\nRetrieving metadata for {dataset_identifier}...\")\n    metadata = client.get_metadata(dataset_identifier)\n    print(f\"Dataset Name: {metadata.get('name')}\")\n    print(f\"Description: {metadata.get('description', '')[:100]}...\")\n\n","lang":"python","description":"Initializes a Socrata client, retrieves the first 5 records from a public dataset (e.g., NYC 311 Service Requests), and fetches its metadata. It demonstrates setting up the client with an optional application token and credentials, and performing a basic data retrieval. Environment variables are used for secure credential handling."},"warnings":[{"fix":"Be aware of the unmaintained status; evaluate if the existing functionality meets your long-term needs without requiring future updates or bug fixes. For data management operations (creating/transforming data), consider `socrata-py` which targets the Socrata Data Management API.","message":"The `sodapy` library is officially unmaintained as of August 31, 2022. No new features or bug fixes will be added. While existing functionality still works, users should proceed with caution and consider the lack of ongoing support for new projects.","severity":"breaking","affected_versions":"2.2.0 and later"},{"fix":"Always use an application token when initializing the `Socrata` client, especially for frequent or large queries. You can obtain one from the Socrata website after creating an account. Pass it as the `app_token` argument: `Socrata(domain, app_token='YOUR_APP_TOKEN')`.","message":"Queries executed without an application token will be subjected to strict throttling limits by the Socrata API. This can lead to slower responses or request failures for extensive data retrieval.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Understand the distinction between the SODA API and the Data Management API. If your task involves complex data transformations or is related to the data management user interface, investigate the `socrata-py` SDK which is designed for the Data Management API.","message":"The Socrata Open Data API (SODA) and `sodapy` are primarily for reading and directly writing to datasets. For write operations that involve data transformations or use the Socrata Data Management Experience (e.g., creating datasets through the UI), the Socrata Data Management API should be used.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Increase the timeout limit for the `Socrata` client by setting the `timeout` parameter during initialization or by updating the `client.timeout` attribute. Example: `client = Socrata(..., timeout=60)` or `client.timeout = 60`.","message":"Socrata API calls have a default timeout of 10 seconds. For large datasets or slow connections, this can result in `Readtimeout error` exceptions, preventing full data retrieval.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Use the `$limit` and `$offset` parameters in your `client.get()` calls to request subsequent pages of data. To retrieve all records, you might need to make multiple paginated requests or use the `client.get_all()` method if available and suitable for your dataset.","message":"SODA APIs are paged and typically return a maximum of 50,000 records per request. Without proper pagination, you might only retrieve a subset of the available data.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z","problems":[]}