Thanks to visit codestin.com
Credit goes to github.com

Skip to content

lannoyy/infotecs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Geoname REST API

Table of content

  1. Installation dependencies
  2. Running
  3. API
  4. Credits

Installation dependencies

$ pip3 install -r requirements.txt

Running the app

$ python3 script.py

API

  1. 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

  2. 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

  3. 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

  4. 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

Credits

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages