Giter Club home page Giter Club logo

open_weather_map_api's Introduction

Open Weather Map API

Provides services to connect to the Open Weather Map API.

Implemented services:

  • Current weather for city id
  • Current weather for geographical coordinates
  • Current weather for multiple city ids

Dependencies:

Requires

  • GNATCOLL (for JSON parsing and logging)
  • AWS (for web services)
  • SI_Units (for formatting)
  • An account at openweathermap

Quick start guide

  1. Download, compile and include in your own project.
  • For now I am assuming you know how to do that (see gprinstall etc.). I may write more detailed instructions later.
  1. Get your OpenWeatherMap API key

  2. Create an account at openweathermap.

  3. Log in to openweathermap.org

  4. In your account settings go to API keys.

  5. Create an API key.

  6. Copy the config.json.example to ~/.config/openweathermap/config.json, preferrably with mode 0600.

  7. Fill in your API key information.

  8. If you have a direct connection to the internet, clear out the proxy configuration (empty strings), otherwise fill in the required information.

This completes the configuration step.

API documentation

  • Please note that this is still work in progress. For example, right now, there is no way of handling or even querying error information. While the software itself seems reasonably stable; if your internet connection drops or your API key is wrong an application using this API does have no way of knowing what went wrong. The only way to figure that out is to look at the log file (if you enabled the debug trace for that). Changes regarding this are planned in the near future.

If you just want to use the provided API without changes, you may start at the source file open_weather_map-api.ads and use one of the Create_XXX subroutines to create a query object. You may want to take a look at test/open_weather_map-application.adb to see how the API is being used.

Query objects

API queries are abstracted in tagged types specifically designed for a single specific API query. All you need to do is to call Perform_Query and read out the returned data. In case of errors etc. the Current parameter will be empty (i.e. the discriminant Valid will be False).

open_weather_map_api's People

Contributors

jellix avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

open_weather_map_api's Issues

Provide API usage examples

Right now, documentation is rather scarce, we should provide some small and simple example applications.

Missing error information propagation

Currently, an application using the API has no way of telling what went wrong (typical sources of errors, wrong proxy configuration, wrong or missing API key, busted internet connection).

Error information should be communicated to the caller instead of just logging stuff and ignoring them for the most part.

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.