A wrapper for the World Time API.
Project description
World Time Wrapper
This package provides an easy interface with the World Time API site.
To install:
python3 -m pip install world-time-api
This requires the requests module if you don't already have it installed.
Usage
To start, create a client for one of the endpoints (currently they only offer 'ip' and 'timezone' endpoints). The below example returns the time in New York.
from WorldTimeAPI import services as serv
myclient = serv.client('timezone')
requests = {"area":"America","location":"New_York"}
# Returns a DateTimeJSON object
response = myclient.get(**requests)
print(response.datetime)
To get a list of regions and locations:
# Returns ListJSON : NOTE: this is only valid for the 'timezone' endpoint
regions = myclient.regions()
print(regions.data)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for world_time_api-2020.5.31-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60777bdc958366f37261b36c586e70bd483fcb33a9871750c81f1ecbca43d7fc |
|
MD5 | 38d522b337c75ee28f5fcfa625953082 |
|
BLAKE2b-256 | 117261ec3edc8aea9ce7445d0c076f2af2cfca75498c5419faaf358b03954ede |