Skip to content

kianwasabi/Weather_Information_API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Weather Information Rest API

This Weather Information API provides a bulky pile of information about wind, weather, sun, and air quality in a designated area.

Feel free to use this API, fork the project to deploy on own CGI or enhance the code with a pull requests.

Enjoy!

Table of Contents

Getting Started

How to use

Easy to use, just call the API by: https://weatherinformation.info + Endpoints

How to deploy

Prerequisites & Dependencies: Server should support python3. Furthermore, all needed dependencies are given in the requirements.txt file.

Endpoints

/api/current?location={LOCATION}&openweathermaps_api_key={APPID}

Retrieves a list of all weatherinformations.

methode

  • GET
q-Parameters
  • location (required): Name of location.
  • OpenWeatherMaps api key (required): Your personal OpenWeatherMaps API key.

Response


{
  "air": {
    "concentration": {
      "CO": 226.97,
      "NH3": 5,
      "NO": 0,
      "NO2": 4.46,
      "O3": 108.72,
      "PM10": 13.64,
      "PM2_5": 12.62,
      "SO2": 3.73
    },
    "humidity": 48,
    "pressure": 1009,
    "quality_index": 3
  },
  "api": {
    "code": 200,
    "msg": null
  },
  "location": {
    "altitute": 82.0,
    "country": "DE",
    "latitude": 52.2647,
    "longitude": 10.5236,
    "name": "Braunschweig",
    "time": {
      "dt": "09.05.2023",
      "simple": "23:46:24",
      "stamp_unix": 1683675984,
      "stamp_utc": "Tue, 09 May 2023 23:46:24 GMT",
      "zone_unix": 7200
    }
  },
  "sun": {
    "azimuth": {
      "deg": 337.98,
      "point": "North"
    },
    "elevation": {
      "deg": -17.74
    },
    "rise": {
      "dt": "09.05.2023",
      "simple": "05:33:24",
      "stamp_unix": 1683610404,
      "stamp_utc": "Tue, 09 May 2023 05:33:24 GMT",
      "zone_unix": 7200
    },
    "set": {
      "dt": "09.05.2023",
      "simple": "20:55:21",
      "stamp_unix": 1683665721,
      "stamp_utc": "Tue, 09 May 2023 20:55:21 GMT",
      "zone_unix": 7200
    }
  },
  "weather": {
    "cloudiness": 97,
    "discription": "overcast clouds",
    "temperatur": {
      "current": 13.89,
      "feel": 12.59,
      "max": 15.77,
      "min": 13.44
    },
    "visibility": 10000
  },
  "wind": {
    "direction": {
      "deg": 110,
      "point": "East"
    },
    "gust": null,
    "speed": 5.66
  }
}

Error Handling

API Error Codes:

Errors can be thrown internally by the server or been recieved by calling another api like openweathermaps. All Errors are displayed in the response as followed:


"api":{
    "code": HTTP Status Code (code),
    "msg":  HTTP Status Message (msg)
    }
HTTP (code) HTTP (msg) Description
200 " " No errors occured.
401 "OpenWeatherMaps API Error: City not found." City not known, check for typos or try another locatiion name.
402 "OpenWeatherMaps API Error: API Key not accepted." OPM API key not accepted.

Authentication & Rate Limiting

Requires a openweahtermaps API authentication (see above).

Does not have a rate limiting. Requests are limited to XXX calls per minute.

Version & Changelog

V1: 20230401 - Tested & Published

V2: 20230509 - added air quality, altitude & http security header

Built-with

flask

license

About

Web API that gives you a lot of weather information for your location

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages