GithubHelp home page GithubHelp logo

weatherassistant's Introduction

WeatherAssistant

WeatherAssistant is a Python application that provides weather suggestions for a specified city and sends these suggestions as messages.

Installation

To install the necessary dependencies, run the following command:

pip install -r requirements.txt

Usage

  1. Copy the .env.example file and rename it to .env:
    cp .env.example .env
  2. Open the .env file and fill in all the environment variables. These variables include:
    • WEATHER_OPENWEATHER_API_KEY: The API key for the weather query
    • WEATHER_COUNTRY_CODE: The country code for querying the weather
    • PUSH_SERVER_SEND_KEY: The key for the sever sauce
    • PUSH_NTFY_SUB_PREFIX: The prefix for the push
    • OPENAI_API_KEY: The API key for OPENAI
    • OPENAI_API_BASE: The base URL for the OPENAI API
  3. Save the .env file and run your application.

The main functionality of the application is encapsulated in the WeatherSub class. Here is a basic example of how to use it:

from WeatherAssistant import WeatherSub

# Create an instance of WeatherSub for the city you are interested in
weather = WeatherSub('city_name')

# Call the process method to get the weather suggestion and send it
weather.process()

Replace 'city_name' with the name of the city you are interested in.

Scheduling

The application includes functionality to schedule the weather suggestions to be sent at specific times. This is done using the schedule library. The scheduling is set up to run the process method of the WeatherSub class every hour between 8:00 and 18:00 China time.

Environment Variables

The application uses environment variables for configuration. These are loaded from a .env file at the root of the project. The following environment variables are used:

  • WEATHER_OPENWEATHER_API_KEY: The API key for the OpenWeather API.

Ensure that you have these environment variables set up in your .env file before running the application.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

weatherassistant's People

Contributors

fjhdream avatar

Stargazers

Burning_git 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.