Giter Club home page Giter Club logo

hko's Introduction

HKO

Build Status Coverage Status

A package to retrieve weather data from the Hong Kong Observatory. Data (private api endpoints) obtained through capturing the traffic of the HKO app and web, and extracting the apk file etc.

Installating required packages

pip install -r requirements.txt

Usage

Every function (request) will return a dict, whereas result and status will be the keys of the returning dict, for example:

>>> import pprint
>>> from hko import astro
>>> pp = pprint.PrettyPrinter(indent=4).pprint
>>> pp(astro())
{   'result': {   'date': '20170906',
                  'moonrise': '1844',
                  'moonset': '0550',
                  'sunrise': '0607',
                  'sunset': '1836'},
    'status': 1}

See the demo for more examples

Functions List

Functions Number of Arguments Type of Argument Arguments Supported Default Arguments
astro() 0 / / /
blog() 0 / / /
earthquake() 1 str ['UC', 'EN'] 'UC'
local_weather() 2 float, float [lat], [lng] /
lunar_date() 0 / / /
major_city_forecast() 1 str ['UC', 'EN'] 'UC'
marine_forecast() 1 str ['UC', 'EN'] 'UC'
rainfall_nowcast() 2 float, float [lat], [lng] /
regional_weather() 0 / / /
serval_days_weather_forecast() 1 str ['UC', 'EN'] 'UC'
south_china_coastal_waters() 1 str ['UC', 'EN'] 'UC'
tide() 0 / / /
uv_index() 1 str ['UC', 'EN'] 'UC'
weather_warning() 1 str ['UC', 'EN'] 'UC'

Status Code

Status Meaning
0 Request Invalid
1 Request Success
2 Request Valid, But Server Returns Error
3 Requested Location Not Inside Hong Kong
4 Requested Data Not Yet Available
5 Request Valid, But Fails To Communicate With Server

Coding Style

  • Following PEP 8
  • Checked by the pylint

TODO

  • unifying the time/date format (perhaps adding a timestamp field in returned dict)
  • major_city_forecast() --> accept place as an argument
  • support more functions

Contributions

We welcome any contributions which fulfilled the coding style

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.