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 simple Telegram bot that converts a phone number to a direct whatsapp chat link

Open in WhatsApp I was using a great app to open a whatsapp chat with a given number directly without saving that number in my contact list, but I fel

Pathfinder 19 Dec 24, 2022
A cracking tool of Xiaomi Dr AI (Archytas / Archimedes)

Archytas Tool 我们强烈抵制闲鱼平台上未经授权的刷机服务! 我对本人之前在程序中为防止违规刷机服务添加未生效的格机代码感到抱歉,在此声明此过激行为与 Crack Mi Dr AI Team 无关,并将程序开源。 A cracking tool of Xiaomi Dr AI (Archy

rponeawa 5 Oct 25, 2022
Bot made with Microsoft Azure' cloud service

IttenWearBot Autori: Antonio Zizzari Simone Giglio IttenWearBot è un bot intelligente dotato di sofisticate tecniche di machile learning che aiuta gli

Antonio Zizzari 1 Jan 24, 2022
Telegram tools

Telegram-Tools Telegram tools. Explanation English | 中文 Features Export group memebrs Add users to the group Send message to users Setup API Open http

4 Apr 02, 2022
A PowerPacked Version Of Telegram Leech Bot With Modern Easy-To-Use Interface & UI !

FuZionX Leech Bot A Powerful Telegram Leech Bot Modded by MysterySD to directly Leech to Telegram, with Multi Direct Links Support for Enhanced Leechi

MysterySD 28 Oct 09, 2022
Library for working with QIWI API.

Library for working with QIWI API.

qxtony 2 Apr 26, 2022
A Python app which retrieves the rank and players' equipped skins during a match

VALORANT rank yoinker About The Project Usage Contributing Contact Acknowledgements Disclaimer About The Project Their Queue Current Skin Current Rank

Isaac Kenyon 270 Jan 04, 2023
Decrypt PSSE layer of PSM Games (on PC)

psse-decrypt Decrypt PSSE layer of PSM Games (on PC) Works on Unity and PSM games, and meets all requirements of: https://github.com/vita-nuova/bounti

Bluzume 32 Oct 11, 2022
Código que verifica se o grafo é Hamiltoniano (Em Python)

Código para encontrar um ciclo de Hamilton em um dado grafo e a partir daí verificar se o grafo é hamiltoniano. Um ciclo hamiltoniano é um ciclo gerad

Hemili Beatriz 1 Jan 08, 2022
A EddieHub API python package.

EddieHub A EddieHub API python package. Made with Python3 (C) @FayasNoushad Copyright permission under MIT License License - https://github.com/Fayas

Fayas Noushad 5 Sep 22, 2021
Python Telegram Bot Template

Python Telegram Bot Template Concepts Customizable python-telegram-bot template implementing code refactoring to streamline development process: handl

Jansen A. Simanullang 1 Jan 25, 2022
python3.5+ hubspot client based on hapipy, but modified to use the newer endpoints and non-legacy python

A python wrapper around HubSpot's APIs, for python 3.5+. Built initially around hapipy, but heavily modified. Check out the documentation here! (thank

Jacobi Petrucciani 140 Dec 21, 2022
An iCal file to transport you to a new place every day until you die

everydayvirtualvacation An iCal file to transport you to a new place every day until you die The library is closed 😔 😔 including a video of the plac

Jacob Chapman 33 Apr 19, 2022
A Telegram AntiChannel bot to ban users who using channel to send message in group

Anti-Channel-bot A Telegram AntiChannel bot to ban users who using channel to send message in group. BOT LINK: Features: Automatic ban Whitelist Unban

Jigar varma 36 Oct 21, 2022
Telegram Bot to Connect Strangers

Telegram Bot to Connect Strangers How to Run Set your telegram bot token as environment variable TELEGRAM_BOT_TOKEN: export TELEGRAM_BOT_TOKEN=your_t

PyTopia 12 Dec 24, 2022
Analyzed the data of VISA applicants to build a predictive model to facilitate the process of VISA approvals.

Analyzed the data of Visa applicants, built a predictive model to facilitate the process of visa approvals, and based on important factors that significantly influence the Visa status recommended a s

Jesus 1 Jan 08, 2022
A frame to create discord bots (for myself) that uses cogs, JSON, activities, and more.

dpy-frame A frame to create discord bots (for myself) that uses cogs, JSON, activities, and more. NOTE: Documentation is incomplete, so please wait un

Apple Discord 1 Nov 06, 2021
A nuker for Roblox accounts.

Roblox-Nuker A nuker for Roblox accounts. Made by Ice Bear#0167 Usage I would recommend running in replit (https://replit.com) as it is deprecated in

7 May 10, 2022
Growtopia server_data.php reader with bypass method, using discord bot

Server_data.php-reader Growtopia server_data.php reader with bypass method, using discord bot How to use 1 install python 2 change your bot token

7 Jul 16, 2022
A modern, easy to use, feature-rich, and async ready API wrapper for Discord written in Python.

A modern, easy to use, feature-rich, and async ready API wrapper for Discord written in Python. Key Features Modern Pythonic API using async and await

Senpai Development 4 Nov 05, 2021