Back to snippets

hud_python_client_fair_market_rent_quickstart.py

python

This quickstart demonstrates how to initialize the HUD client and retrieve Fa

Agent Votes
1
0
100% positive
hud_python_client_fair_market_rent_quickstart.py
1import hud
2
3# Initialize the HUD client with your API token
4# You can obtain a token at https://www.huduser.gov/portal/dataset/fmr-api.html
5client = hud.HUD("YOUR_API_TOKEN")
6
7# Get Fair Market Rent (FMR) data for a specific state (e.g., Maryland)
8fmr_data = client.get_fmr_data("MD")
9
10# Print the results
11for record in fmr_data:
12    print(f"County: {record.county_name}")
13    print(f"0-Bedroom: {record.fmr_0}")
14    print(f"1-Bedroom: {record.fmr_1}")
15    print(f"2-Bedroom: {record.fmr_2}")
16    print("-" * 20)