Welcome to IClinic-Weather’s documentation!

Contents:

This module contains functions to solve the challenge proposed by iClinic.

iclinic_wea.handler_err(resp)[source]

Handler request error.

resp: http.client.HTTPResponse
Response of request

value: byte

iclinic_wea.main()[source]

Main function.

iclinic_wea.req(service, params, timeout=10)[source]

Request function.

service: str
The name of the service provided by the API
params: dict
The params of api
timeout: float, optional
The request timeout

resp: dict

>>> params = {'q': 'Ribeirão Preto', 'appid': 'API KEY'}
>>> resp = req("forecast", params=params, timeout=15)
iclinic_wea.umbrella(args)[source]

Checking if take an umbrella.

args: dict

>>> _args = {'city': 'Ribeirão Preto', 'appid': 'API KEY', 'limit': 70,
             'timeout': 10}
>>> umbrella(_args)
You should take an umbrella in these days: Tuesday and Wednesday.
iclinic_wea.ut2weekday(unixtimestamp)[source]

Return weekday name based on unix time.

unixtimestamp: int
Unix timestamp

resp: string

iclinic_wea.val_empty(value)[source]

Validate if value is empty.

value: str
Command line value

value: str

>>> nvalue = val_fpos("hi")
>>> print("Value is: %s" % nvalue)
Value is hi
iclinic_wea.val_fpos(value)[source]

Validate if float is positive.

value: str
Command line value

value: float

>>> nvalue = val_fpos(15)
>>> print("Value is: %.2f" % nvalue)
Value is 15.00

Indices and tables