Git Product home page Git Product logo

vwapi's Introduction

VWapi

Quality Gate Status GitHub issues GitHub forks GitHub stars GitHub license

Visual Weather api. Returns beautiful pictures with the current weather.

image image image

Installation:

sudo apt update -y && sudo apt upgrade -y
sudo apt install -y git python3 python3-pip 
git clone https://github.com/mishailovic/VWapi
cd VWapi
pip3 install -r requirements.txt
python3 -m uvicorn weatherapi:app

Usage:

import requests
import time
from PIL import Image
import io
language = "en" # can be "en" or "ru"
place = "Moscow" # can be any city, place, street, or site, geocoder automatically selects location. 
timestamp = round(time.time()) # optional timestamp, can be any unix timestamp from now, to now + three days 
r = requests.get(f"https://vwapi.mxf.su?lang={language}&city={place}&timestamp={timestamp}")
image = Image.open(io.BytesIO(r.content))
image.show()

Notes about performance

StreamingResponse

Usually StreamingResponse is slower than Response, but it depends on the environment where VWapi is gonna be deployed, run some tests before and after using StreamingResponse and see which one has better performance.

If you want to use StreamingResponse set USE_STREAMING_RESPONSE environment variable to true.

Telegram bot setup

Demo

screenshot

screenshot

You can also setup your own copy of @visualweatherbot

First, install mogodb, and create directory with database. (If you don't need analytics you can skip this step)

sudo apt install mongodb-server
sudo mkdir /data
sudo mkdir /data/db

Run mongo, copy the connection url, and put it in config.py. Then, talk with @botfather and get your telegram botapi token, you also need to put it in config.py.

Now, form repo directory run:

pip3 install -r requirements.txt
python3 bot.py

Your telegram bot is ready.

Localisation

Currently supported languages: "en", "ru" If you wish to add your own language, you can easily edit few lines in /utils/constants.py and make pull request.

Credits:

render.py based on https://github.com/adrian-kalinin/TeleWeatherRobot/blob/master/bot/utils/render.py Huge thanks to its developer @adrian-kalinin

Thx to @notmyst33d for https://github.com/notmyst33d/Dripcons

All contributors of this project.

vwapi's People

Contributors

aiexz avatar imgbotapp avatar mishailovic avatar notmyst33d avatar roj1512 avatar thehamkercat avatar

Stargazers

 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.