Coder Social home page Coder Social logo

mitchellkrogza / weather-api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kemifree/weather-api

0.0 3.0 0.0 128 KB

A Python wrapper for the Yahoo Weather API. With the API, you can get up-to-date weather information for any location, including 5-day forecast, wind, atmosphere, astronomy conditions, and more.

Home Page: https://anthonybloomer.github.io/weather-api/

Python 100.00%

weather-api's Introduction

weather-api

Build Status codecov

A Python wrapper for the Yahoo Weather API.

With the API, you can get up-to-date weather information for any location, including 5-day forecast, wind, atmosphere, astronomy conditions, and more. You can lookup weather by woeid, city name or lat/long.

For more detailed examples and tutorial, check out Yahoo Weather Developer Page. For more information, check out the API documentation.

Install

pip install weather-api

Examples

Lookup WOEID via http://weather.yahoo.com.

from weather import Weather, Unit

weather = Weather(unit=Unit.CELSIUS)

lookup = weather.lookup(560743)
condition = lookup.condition

print(condition.text)

Lookup via location name.

weather = Weather(unit=Unit.CELSIUS)
location = weather.lookup_by_location('dublin')
condition = location.condition
print(condition.text)

Get weather forecasts for the upcoming days.

weather = Weather(unit=Unit.CELSIUS)

forecasts = location.forecast
for forecast in forecasts:
    print(forecast.text)
    print(forecast.date)
    print(forecast.high)
    print(forecast.low)

Lookup via latitude and longitude

weather = Weather(Unit.CELSIUS)
lookup = w.lookup_by_latlng(53.3494,-6.2601)
condition = lookup.condition
print(condition.text)

CLI Usage

usage: weather [-h] [--unit [{c,f}]] location

positional arguments:
  location        The location to lookup.

optional arguments:
  -h, --help      show this help message and exit
  --unit [{c,f}]

Example

$ weather dublin --u c

weather-api's People

Contributors

mitchellkrogza avatar bhaumikmistry avatar

Watchers

James Cloos avatar  avatar  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.