File size: 1,707 Bytes
98c76e4 c8b54b3 98c76e4 c8b54b3 98c76e4 c8b54b3 98c76e4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
import requests
from markdownify import markdownify
def import_dec2020_datasets_homepage() -> str:
"""
Fetches the homepage for the the U.S. Census Bureau 2020 decennial census API housed at https://api.census.gov/data/2020/dec/dp.html.
Contains descriptions of available datasets.
Also includes links to additional helpful documentation such as available geographies and example API calls.
Args:
Returns:
str: The homepage in markdown format
"""
response = requests.get("https://api.census.gov/data/2020/dec/dp.html")
return markdownify(response.text.strip())
def import_dec2020_dp_geographies() -> str:
"""
Fetches information on available geographies for the the U.S. Census Bureau 2020 decennial census demographic profile API housed at https://api.census.gov/data/2020/dec/dp/geography.html.
Includes:
* Geography Levels
* Geography Hierarchy.
Args:
Returns:
str: The information in markdown format
"""
response = requests.get("https://api.census.gov/data/2020/dec/dp/geography.html")
return markdownify(response.text.strip())
def import_dec2020_dp_variables() -> str:
"""
Fetches information on available variables for the the U.S. Census Bureau 2020 decennial census demographic profile API housed at https://api.census.gov/data/2020/dec/dp/variables.html.
* "Name" -- used to access variable during API calls
* "Label" -- description of variable
Args:
Returns:
str: The information in markdown format
"""
response = requests.get("https://api.census.gov/data/2020/dec/dp/variables.html")
return markdownify(response.text.strip())
|