$ pip3 install -r requirements.txt$ python3 script.py-
url - localhost:8000/city/geonameid/{geonameid}
Return city by geonameid
Format:
{ "geonameid": "451756", "name": "Zarech’ye", "asciiname": "Zarech'ye", "alternatenames": "", "latitude": "56.68265", "longitude": "34.70984", "feature_class": "P", "feature_code": "PPL", "country_code": "RU", "cc2": "", "admin1_code": "77", "admin2_code": "", "admin3_code": "", "admin4_code": "", "population": "0", "elevation": "", "dem": "178", "timezone": "Europe/Moscow", "modification_date": "2011-07-09\n" }With status 200
If city not found, return:
{ "detail": "Item not found" }with status 404
-
url - localhost:8000/city/page/{count_per_sheet}/{sheet}
Return page with cities Sheet start with 0!
Format:
[ { "geonameid": "451756", "name": "Zarech’ye", "asciiname": "Zarech'ye", "alternatenames": "", "latitude": "56.68265", "longitude": "34.70984", "feature_class": "P", "feature_code": "PPL", "country_code": "RU", "cc2": "", "admin1_code": "77", "admin2_code": "", "admin3_code": "", "admin4_code": "", "population": "0", "elevation": "", "dem": "178", "timezone": "Europe/Moscow", "modification_date": "2011-07-09\n" } ]With status 200
If city not found, return:
{ "detail": "Item not found" }With status 404
-
url - localhost:8000/city/name/{city}?second_city={second_city}
If second city skip return city by name
Format:
{ "geonameid": "451756", "name": "Zarech’ye", "asciiname": "Zarech'ye", "alternatenames": "", "latitude": "56.68265", "longitude": "34.70984", "feature_class": "P", "feature_code": "PPL", "country_code": "RU", "cc2": "", "admin1_code": "77", "admin2_code": "", "admin3_code": "", "admin4_code": "", "population": "0", "elevation": "", "dem": "178", "timezone": "Europe/Moscow", "modification_date": "2011-07-09\n" }With status 200
If city not found, return:
{ "detail": "Item not found" }with status 404
If second city selected:
If one from cities are nothern:
{ "northern": {nothern city}, "timezone": true }Else:
{ "northern": "same", "timezone": true }If at least one city not found, return:
{ "detail": "At least one item not found" }with status 404
-
url - localhost:8000/city/like/{part_name}
Return cities, which names contain part_name
Format:
[ { "geonameid": "451756", "name": "Zarech’ye", "asciiname": "Zarech'ye", "alternatenames": "", "latitude": "56.68265", "longitude": "34.70984", "feature_class": "P", "feature_code": "PPL", "country_code": "RU", "cc2": "", "admin1_code": "77", "admin2_code": "", "admin3_code": "", "admin4_code": "", "population": "0", "elevation": "", "dem": "178", "timezone": "Europe/Moscow", "modification_date": "2011-07-09\n" } ]With status 200
If city not found, return:
{ "detail": "Item not found" }with status 404