Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

world-time-api-2020.5.31.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

world_time_api-2020.5.31-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file world-time-api-2020.5.31.tar.gz.

File metadata

  • Download URL: world-time-api-2020.5.31.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for world-time-api-2020.5.31.tar.gz
Algorithm Hash digest
SHA256 bf29ad4e14fa35aed9d34998227a23a4c78dcdefcd353afffed62d534e2b63f8
MD5 8e3f173f290ed41568fa22e93c7d600f
BLAKE2b-256 511bf2aee673bd0fdcdb0c7ae4ebf5195738b951b958f2947be545de61a29cc9

See more details on using hashes here.

File details

Details for the file world_time_api-2020.5.31-py3-none-any.whl.

File metadata

  • Download URL: world_time_api-2020.5.31-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for world_time_api-2020.5.31-py3-none-any.whl
Algorithm Hash digest
SHA256 60777bdc958366f37261b36c586e70bd483fcb33a9871750c81f1ecbca43d7fc
MD5 38d522b337c75ee28f5fcfa625953082
BLAKE2b-256 117261ec3edc8aea9ce7445d0c076f2af2cfca75498c5419faaf358b03954ede

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page