Coder Social home page Coder Social logo

globant_weather_api_test's Introduction

Weather API

Create a weather API in Python.

External API: openweathermap

Consume external API and create a human readable response for city/country pair using a get request.

Note: Globant test in linux environment.

install redis

sudo apt install redis-server

Configurations used from file data/redis.conf, no more steps need.

Use

Set python environment

use the shells/create_environ.sh script for create the python environment.

bash shells/create_environ.sh

You can see inside the script for the step by step commands.

Play app

Use the shells/run_app.sh script for setting the environment variables, start redis server and play the application. redis-server configuration file is data/redis.conf. the cached data will be stored at data/cache.rdb. Cached data will be deleted after CACHE_TIME_SECONDS (environment variable) seconds. All environment variables are exported using shell scripts, you can take a look by opening the .sh file at shells/*.sh

bash shells/run_app.sh

Use a normal web browser to check the application:

app url: http://127.0.0.1:8000/weather

arguments:

  • city: city as an aphabetical string only
  • country: Country as an alphabetical string in format iso2 only.

example:

http://127.0.0.1:8000/weather?city=guayaquil&country=ec

Play test

For make all the tests first initiate the app in one terminal and the test in other terminal:

# terminal 1
bash shells/run_app.sh
# terminal 2
bash shells/test.sh

Notes

Some ranges for human readable

Some information about ranges were taken from the following links. (ranges are shown in data/ranges.json)

globant_weather_api_test's People

Watchers

Emmanuel Morán Barreiro 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.