{
  "id": 21771640,
  "title": "Federal Register API in Python: final rules taking effect in the next 30 days, by CFR title, in a CSV",
  "url": "https://urgent.news/2026/11/25/federal-register-api-in-python-final-rules-taking-effect-in-the-next",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-11-25T10:30:56.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/yourevenings/federal-register-api-in-python-final-rules-taking-effect-in-the-next-30-days-by-cfr-title-in-a-3pp3"
  },
  "original_language": "en",
  "account": "To generate a CSV file listing federal rules that take effect in the next 30 days, use Python and the requests package. This script accesses the Federal Register API, which doesn't require authentication or a key. First, import the necessary libraries: csv, re (regular expressions), sys, time, Counter, date, timedelta, RobotFileParser, and requests. Set the number of days to 30, then initialize a session object and set the User-Agent header. Load the robots.txt file from the API's website to ensure the script complies with the API's usage policy. Define the query parameters including the type of documents (RULE), effective date range (from tomorrow to 30 days from today), and requested fields (document_number, title, action, agencies, publication_date, effective_on, dates, cfr_references, significant, and html_url).\n\nThe script initializes an empty list to store documents and a URL variable to track pagination. It loops through pages of results until there are no more pages, appending each result to the documents list. Once all documents are collected, it creates another empty list to store rows for the CSV output. Iterate through the documents, converting the effective_on field to a date object. Extract and sort dates from the DATES text field, filtering out the current date. If there are extracted dates, add a row to the rows list with the document number, title, action, agencies, publication_date, effective_on, sorted dates, CFR references, significant flag, and HTML URL.\n\nAfter populating the rows list with the relevant information, write the data to a CSV file using the csv module's writer method. This process allows you to programmatically generate a CSV file listing all federal rules set to take effect within the next 30 days, making it easy to monitor compliance with upcoming regulatory changes.",
  "summary": "Article type: How-to guide (one task: list the final federal rules that take effect in the next 30 days, one row per CFR title, in a CSV) Prerequisites: Python 3.9+ and the requests package. FederalRegister.gov needs no key and no sign-up. You need an Apify account only for the last section. Tested on: 25 November 2026 (live API). A final rule doesn't change the Code of Federal Regulations (CFR)…",
  "key_points": [
    "Python script accesses Federal Register API without authentication",
    "Queries for RULE documents with effective dates in next 30 days",
    "Generates CSV file listing upcoming federal rules"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}