Skip to content
This repository has been archived by the owner on Oct 4, 2022. It is now read-only.

ways/pyyrlib

Repository files navigation

As I was unable to establish contact with the author of https://gitorious.org/altut-i-python/pyyrlib, I created a copy here.

The file verda.txt is from http://om.yr.no/verdata/xml/.


TODO
----

* Sorting / searching in db has weird priorites. Ex: York gives jamaica/manchester/york. Resolve like this:
** Any request with several hits; list hits. no weather.
** Allow/requre user to specify: england/york or europe/york


Importing data into mysql
-------------------------

This is to enable name search (Norway and international).
* Create db with pyyrlib.sql
* Run 01-parse-data.sh
* Run 02-import-data.py






Copy of original README:



About
-----

This library provides a simple api for accessing weather data from the Norwegian web site yr.no. At the time being, it is extremely simple.

Example
-------

Import the module:

    >>> import pyyrlib

Search for location:

    >>> pyyrlib.get_location_url('location-name')
    http://url-to-yr.no/xml-data-for-location-name.xml

Get weather data for the found location:

    >>> pyyrlib.returnWeatherData('url-to-yr/location.xml')
    { weatherdata as dictionary }

Simple command line usage:

    bash: pyyrlib.py 'url-ty-yr/location.xml'
    [ acceptably formatted weatherdata in clean text ]

Known issues
------------

- Fragmented and sketchy

Todo
----

- Develop into a real python library
- Connect the search function and stedsnavn.txt
- https://github.com/wckd/python-yr look better. Check if it's feasible to migrate to it.
- Add proper hour-by-hour for foreign locations.
- Add days to printout so days can easily be distinguished [requested]
- Add warnings to bottom, i.e. flood warnings.
- Python3, general clean-up.