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
Telegram bot to stream videos in telegram voicechat for both groups and channels. Supports live strams, YouTube videos and telegram media.

Telegram bot to stream videos in telegram voicechat for both groups and channels. Supports live strams, YouTube videos and telegram media.

SUBIN 449 Dec 27, 2022
Heroku app to explore boardgame data

A Dashboard for the Board Game Geeks among us Link to Application As many Board Game Geeks like myself track the scores of board game matches I decide

Maarten Grootendorst 20 Nov 23, 2022
Download nitro generator that generates free nitro code that you can use for Discord

Download nitro generator that generates free nitro code that you can use for Discord, run it and wait for free nitro to come

Umut Bayraktar 154 Jan 05, 2023
Auto Moderation is a powerfull moderation bot

Auto Moderation.py Auto Moderation a powerful Moderation Discord Bot 🎭 Futures Moderation Auto Moderation 🚀 Installation git clone https://github.co

G∙MAX 2 Apr 02, 2022
💰 Import your ING Germany bank statements via FinTS into YNAB.

Import your ING Germany bank statements via FinTS into YNAB. Setup Before setting this up, please register your FinTS product – it's free and takes on

Arne Bahlo 23 Jan 21, 2022
Clippin n grafting Backend

Clipping' n Grafting Presenting you, 🎉 Clippin' n Grafting 🎉 , your very own ecommerce website displaying all your artsy-craftsy stuff. Not only the

Google-Developer-Student-Club-ISquareIT (GDSC I²IT) 2 Oct 22, 2021
Unofficial GoPro API Library for Python - connect to GoPro via WiFi.

GoPro API for Python Unofficial GoPro API Library for Python - connect to GoPro cameras via WiFi. Compatibility: HERO3 HERO3+ HERO4 (including HERO Se

Konrad Iturbe 1.3k Jan 01, 2023
Allows you to easily share bookmarks from Raindrop.io in Telegram chats.

Allows you to easily share bookmarks from Raindrop.io in Telegram chats. As well as save links/photos/longreads from Telegram right into Raindrop.io. Join us, we have a nice 'reader mode' :)

Oleh 36 Dec 19, 2022
Pluggable Telethon - Telegram UserBot

A stable pluggable Telegram userbot, based on Telethon.

Team Ultroid 2.3k Dec 30, 2022
An all-purpose Discord bot written in Python featuring a diverse collection of practical utilities.

GlazeGlopBot Table of Contents About Setup Usage Commands Command Errors Cog Management Local Sound Files Cogs Mod QR RNG VC Weather Proposed Features

Edison Ye 0 May 12, 2022
A jokes api python module

A jokes api python module

Fayas Noushad 3 Nov 28, 2021
discord voice bot to stream radio

Radio-Id Bot (Discord Voice Bot) Radio-id-bot (Radio Indonesia) is a simple Discord Music Bot built with discord.py to play a radio from some Indonesi

Adi Fahmi 20 Sep 20, 2022
Using GNU Radio and HackRF One to Receive, Analyze and Send ASK/OOK signals

play_with_ask NIS-8016 Lab A code: Recv.grc/py: Receive signals and match with ASK button using HackRF and GNU radio. I use AM demod block(can also in

Chen Anxue 1 Jul 04, 2022
Lumberjack-bot - A game bot written for Lumberjack game at Telegram platform

This is a game bot written for Lumberjack game at Telegram platform. It is devel

Uğur Uysal 6 Apr 07, 2022
Python API Client for Close

Close API A convenient Python wrapper for the Close API. API docs: http://developer.close.com Support: Close 56 Nov 30, 2022

A liblary whre you can find helpful functions for your discord bot

DBotUtils A liblary whre you can find helpful functions for your discord bot Easy setup Setup is easily and flexible. Change anytime. After setup just

Kondek286 1 Nov 02, 2021
a Music bot for discord

Bot this is a discord bot made by AnHalfGuy.py#6031(ID: 747864072879603743) and HastagStopAnimalAbuse#5617(ID :349916852308279306) This Bot Is For Mus

A Discord Bot Development 1 Oct 29, 2021
Ditch Xiaomi's cloud and use a Telegram bot instead

Yi-Home_Telegram_Bot_Interface Ditch Xiaomi's cloud and use a Telegram bot instead Features Motion detection Works by monitoring a tmp file that is cr

Erli 10 Aug 18, 2022
Asyncevents: a small library to help developers perform asynchronous event handling in Python

asyncevents - Asynchronous event handling for modern Python asyncevents is a small library to help developers perform asynchronous event handling in m

Mattia 5 Aug 07, 2022
Want to play What Would Rather on your Server? Invite the bot now! 😏

What is this Bot? 👀 What You Would Rather? is a Guessing game where you guess one thing. Long Description short Take this example: You typed r!rather

FSP Gang s' YT 3 Oct 18, 2021