Socket
Socket
Sign inDemoInstall

world-time-api

Package Overview
Dependencies
0
Maintainers
1
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    world-time-api

A wrapper for the World Time API.


Maintainers
1

Readme

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)

FAQs


Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc