Design and build a wrapper for the Open Weather API current weather data service

Overview

Full Stack Code Assessment Challenge

python3.7 redis AWS Docker Swagger

Design and build a wrapper for the Open Weather API current weather data service that returns a city's temperature, with caching, also allowing for the temperature of the latest queried cities that are still validly cached to be retrieved.

PROJECT STRUCTURE

The project structure is based on the official Flask RESTPlus scaling your project

.
├── main
│   ├── helpers
│   │   └── redis.py
│   ├── __init__.py
│   └── resources
│       ├── __init__.py
│       └── openweather
│           ├── __init__.py
│           ├── routes.py
│           ├── test_request_by_citY_name.py
│           └── test_request_temperature.py
├── tests
│   ├── base.py
│   ├── test_config.py
│   ├── serializers.py
│   └── services.py
├── .dockerignore
├── .gitignore
├── app.py   
├── config.py
├── docker-compose.yml
├── Dockerfile
├── README.md
└── requirements.txt
Folders
  • main - All the RESTful API implementation is here.
  • main/helpers - Useful function for working with redis cache.
  • tests - All the tests used on API.
Files
  • main/__init__.py - Resource agroupment for all Namespaces.
  • main/resources/__init__.py - The Flask Application factory (create_app()).
  • config.py - Config file for envs, global config vars and so on.
  • Dockerfile - Dockerfile used to build a Docker image.
  • .dockerignore - Lists files and directories which should be ignored while Docker build process.
  • .gitignore - Lists files and directories which should not be added to git repository.
  • requirements.txt - All project dependencies.
  • app.py - The application entrypoint.

RUNNING ON CLOUD

You can check this application live running on AWS cloud using Lambda functions: My Cloud App

RUNNING ON DOCKER

Requirements

Make sure you have already installed both Docker Engine and Docker Compose. You don’t need to install Python or Redis, as both are provided by Docker images.

Clone the repository
$ git clone https://github.com/duanribeiro/DevGrid_exercise.git
$ cd DevGrid_exercise
Add Environment Variables

A file called docker-compose.yml contains all environment variables. Variables declared in file have the following format: ENVIRONMENT_VARIABLE=value.

In order for Flask to run, there must be set OPENWEATHER_ENDPOINT, OPENWEATHER_APIKEY, CACHE_TTL_SECONDS, DEFAULT_MAX_NUMBER variables declared.

Variable Default Discussion
OPENWEATHER_ENDPOINT https://api.openweathermap.org/data/2.5/weather Endpoint used to fetch data from Open Weather API.
OPENWEATHER_APIKEY your_secret_api_password The API key is a unique identifier that authenticates requests associated with your project for usage and billing purposes.
CACHE_TTL_SECONDS 300 Time to live (TTL) is an integer value that specifies the number of seconds until the cached key expires.
DEFAULT_MAX_NUMBER 5 Default value from max number of queried cities that are still valid.
REDIS_ENDPOINT redis localhost Redis host address.
REDIS_PORT 6379 Redis host port.
Create and run the images:
$ docker-compose up

It will deploy 2 docker containers:

TESTING

Unittest supports simple test discovery. In order to be compatible with test discovery, all of the test files must be importable from the top-level directory of the project.

$ python -m unittest discover .\tests\
Owner
Duan Rafael Ribeiro
Economist and developer, i believe that technology is a essencial part in the development of companies and people.
Duan Rafael Ribeiro
A delivery protection and notification system

DeliveryProtect This project builds a delivery protection and notification system, based on integration of Arduino Uno and Raspberry Pi 4. The codes a

2 Dec 13, 2021
Python script to extract all Humble Bundle keys and redeem them on Steam automagically.

humble-steam-key-redeemer Python script to extract all Humble keys and redeem them on Steam automagically. This is primarily designed to be a set-it-a

74 Jan 08, 2023
A Discord bot coded in Python

Perseverance-Bot By Toricane Replit Code | GitHub Code | Discord Server | Website Perseverance is a multi-purpose bot coded in Python. It has moderati

4 Mar 30, 2022
A Slash Commands Discord Bot created using Pycord!

Hey, I am Slash Bot. A Bot which works with Slash Commands! Prerequisites Python 3+ Check out. the requirements.txt and install all the pakages. Insta

Saumya Patel 18 Nov 15, 2022
A Telegram Bot To Stream Videos in Telegram Voice Chat.

Video Stream X Bot Telegram bot project for streaming video on telegram video chat, powered by tgcalls and pyrogram Deploy to Heroku 👨‍🔧 The easy wa

Mⷨoͦns͛ᴛⷮeͤrͬ Zeͤrͬoͦ 13 Dec 05, 2022
Discord Panel is an AIO panel for Discord that aims to have all the needed tools related to user token interactions, as in nuking and also everything you could possibly need for raids

Discord Panel Discord Panel is an AIO panel for Discord that aims to have all the needed tools related to user token interactions, as in nuking and al

11 Mar 30, 2022
Framework to make using Bottle less time-consuming and easier

A class for the Bottle API to reduce clutter and difficulty while creating a website.

Tygzy 0 Dec 26, 2022
A Collection Manager for the objkt.com Minting Factory

Objkt Collection Manager A Collection Manager for the objkt.com Minting Factory. This contract can create a collection on objkt.com and mint into it.

Asbjorn Enge 5 Nov 22, 2022
Python CMR is an easy to use wrapper to the NASA EOSDIS Common Metadata Repository API.

This repository is a copy of jddeal/python_cmr which is no longer maintained. It has been copied here with the permission of the original author for t

NASA 9 Nov 16, 2022
Update your World of Warcraft AddOns hosted on GitHub

AddOns Update Tool Tool to update World of Warcraft AddOns hosted on GitHub Features Pure Python: only Dulwich and Colorlog Multithreaded tasks Manual

Mr. Alchemist 16 Dec 06, 2022
3X Fast Telethon Based Bot

📺 YouTube Song Downloader Bot For Telegram 🔮 3X Fast Telethon Based Bot ⚜ Easy To Deploy 🤗

@Dk_king_offcial 1 Dec 09, 2021
BLYRIC is a Twitter bot that tweets a song lyric every night.

BLYRIC BLYRIC, a bot that tweets a song lyric every night. Follow on Twitter: @blyric_ Overview BLYRIC is a Twitter bot that tweets a song quote every

Bruno Kenzo Hyodo 6 Oct 05, 2022
See GitHub API on terminal

gitbees About gitbees uses the GitHub API to show user data and ``repos` Using Make sure you have a python interpreter and then python gitbees.py Lice

Marcello Belanda 1 Nov 29, 2021
Instant messaging client in tkinter

Concord_client_tk Instant messaging client in tkinter Contributors : Ilade-s [https://github.com/Ilade-s] Doku [https://github.com/D0kuhebi] Descripti

Raphaël Merlet 2 Jun 15, 2022
A multi-purpose Discord bot with simple moderation commands, reaction roles, reminders, and much more!

Nokari This is the rewrite of Nokari. There are still a lot of things to be done. I'm still working on the internal logic, so the bot basically has no

Norizon 13 Nov 17, 2022
A module grouping multiple translation APIs

translatepy (originally: translate) An aggregation of multiple translation API Translate, transliterate, get the language of texts in no time with the

349 Jan 06, 2023
Rotten Tomatoes API for Python

rottentomatoes.py rottentomatoes offers an easy-to-use Python wrapper to interact with the Rotten Tomatoes API. Before you try and use the API, make s

Zach Williams 88 Dec 15, 2022
Pagination for your discord.py bot using the discord_components library!

Paginator - discord_components This repository is just an example code for how to carry out pagination using the discord_components library for python

Skull Crusher 9 Jan 31, 2022
Cryptocurrency Trading Bot - A trading bot to automate cryptocurrency trading strategies using Python, equipped with a basic GUI

Cryptocurrency Trading Bot - A trading bot to automate cryptocurrency trading strategies using Python, equipped with a basic GUI. Used REST and WebSocket API to connect to two of the most popular cry

Francis 8 Sep 15, 2022
Un bot leggero basato su py-cord facile da hostare sul cloud

GalbiBot Un bot leggero basato su py-cord facile da hostare sul cloud Guida installazione su una macchina Per far funzionare il bot devi aver installa

Galbaninoh 2 Oct 21, 2022