Coder Social home page Coder Social logo

weather-bot's Introduction

Weatheucity

Weatheucity

About The Project

Functional: A telegram weather bot that displays weather information of a given city from the site https://openweathermap.org/.

You can check the weather for the following periods:

  • at the moment (now);
  • for the next 24 hours (24 hours);
  • for the next 5 days (5 days).

bot starting

Resources and APIs

  • Python 3.9.13
  • requests
  • datetime
  • aiogram
  • OpenWeatherMap API
  • Telegram Bot API

Within the project folder, you will find the 'main.py', 'weather_def.py', and 'config.py' files, which are the main components of the project.

  • main.py contains the code to start the Telegram bot and process user commands;
  • weather_def.py contains functions for calling the OPENWEATHER API and getting weather data;
  • config.py contains YOUR unique OPENWEATHER API and Telegram bot token .

How to set up:

  1. Create a Telegram bot and grab the token.
  • Enter @Botfather in Telegram or click here;
  • Click “Start” to activate BotFather bot;
  • Choose or type the /newbot command and send it;
  • Choose a name and a unique username for your bot;
  • Choose or send the command /token;
  • Grab your token.
  1. We are going to use OpenWeatherMap API, which requires an API key. You can get one for free by logging in to their website.

  2. Open the config.py file and replace your BOT_TOKEN and OPEN_WEATHER_MAP_API_KEY.

  3. Before running the bot, you will need to install all the requirement libraries through the command line or terminal using these commands:

  • pip install requests
  • pip install aiogram
  1. You've done, enjoy this bot!

weather-bot's People

Contributors

dkalenov avatar

Watchers

 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.