Git Product home page Git Product logo

api_modelo's Introduction

REST API - Python - Flask

REST API creada con Python, el framework web Flask y con data que se descargo en un archivo JSON se las ciudades de Estados Unidos de America y Canada, con el protocolo HTTP y el método GET.


Para Correger la aplicacion se debe:

  1. Crear un virtualenv en mi caso use pyenv para crear un entorno virtual:

    $ pyenv virtualenv 3.9.5 <nombre_ambiente>

    Luego se activa el entorno virtual:

    $ pyenv activate <nombre_ambiente>

    y posteriormente se corre el paso 2, para mayor insformacion consultar la pagina https://realpython.com/intro-to-pyenv/

  2. Instalar las librerias que estan en el archivo de requirements.txt ejecuntado el siguiente comando

    $ pip3 install -r requirements.txt

  3. Luego a traves del shell se ingresa a la carpeta principal, luego ingresas a la carpeta controller y se ejecuta el siguiente comando

    $ flask run

Ahora, la API está escuchando en el puerto localhost 5000. Los endpoints son:

Estructura del código

El árbol de directorios del código fuente se ve así:

.
├── application
│   ├── __init__.py
│   └── services
│       ├── searchs.py
│       ├── suggestions.py
│       └── __init__.py
├── controller
│   ├── app.py ---------------> API entry point
│   ├── __init__.py
├── infrastructure
│   └── data
│       ├── CA_final.json
│       └── US_final.json
├── requirements.txt
└── test
    ├── application
    │   ├── __init__.py
    │   └── test_services.py
    ├── base_test_case.py
    ├── controller
    │   ├── __init__.py
    │   └── test_app.py
    └── __init__.py

Pruebas

Ejecutando pruebas

Las pruebas se han creado con Unittest.

Solucion por

  • José Nicolielly - - jcnil

api_modelo's People

Contributors

jcnil avatar

Stargazers

José Luis Tello avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.