Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Endpoints for Population Density and Gender Ratio Description: #72

Closed
wants to merge 5 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions src/routes/geo/country.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

country_router = APIRouter(tags=["Country Data"])


@country_router.get("/codes")
async def get_country_code_dictionary():
try:
Expand All @@ -14,7 +13,6 @@ async def get_country_code_dictionary():
except:
raise internal_error_500()


@country_router.get("/data")
async def get_country_data(data: CountryCodeModel = Depends()):
try:
Expand All @@ -23,7 +21,6 @@ async def get_country_data(data: CountryCodeModel = Depends()):
except Exception as e:
raise internal_error_500()


@country_router.get("/flag")
async def get_country_flag(data: CountryCodeModel = Depends()):
try:
Expand All @@ -32,7 +29,6 @@ async def get_country_flag(data: CountryCodeModel = Depends()):
except Exception as e:
raise internal_error_500()


@country_router.get("/name")
async def get_country_name(data: CountryCodeModel = Depends()):
try:
Expand All @@ -41,7 +37,6 @@ async def get_country_name(data: CountryCodeModel = Depends()):
except Exception as e:
raise internal_error_500()


@country_router.get("/officialname")
async def get_official_country_name(data: CountryCodeModel = Depends()):
try:
Expand All @@ -50,11 +45,26 @@ async def get_official_country_name(data: CountryCodeModel = Depends()):
except Exception as e:
raise internal_error_500()


@country_router.get("/subdivisions")
async def get_country_subdivisions(data: CountryCodeModel = Depends()):
try:
res = co.code_to_subdivision(data.code)
return ok_200(res)
except Exception as e:
raise internal_error_500()

@country_router.get("/population_density")
async def get_country_population_density(data: CountryCodeModel = Depends()):
try:
res = co.code_to_population_density(data.code)
return ok_200(res)
except Exception as e:
raise internal_error_500()

@country_router.get("/gender_ratio")
async def get_country_gender_ratio(data: CountryCodeModel = Depends()):
try:
res = co.code_to_gender_ratio(data.code)
return ok_200(res)
except Exception as e:
raise internal_error_500()