Skip to main content

Mirroclock example

Project description

mirrorclock

This is an example repository for flask-restful usage, and packaging it for pypi. The logic used is the mirrored wallclock. Apart from the REST endpoint, there is a command line tool which uses the same logic to test the functionality.

The mirrorclock.wsgi:app entrypoint can be supplied to uwsgi for publication over HTTP.

Installation

You can build it from the repo, or simply get it from pypi:

pip install mirrorclock-gczuczy

Usage

Using the command line client: $ date Tue Oct 4 09:35:10 UTC 2022 $ mirrorclock 02:25

From python: `` $ python3 Python 3.8.13 (default, Jul 22 2022, 15:16:53) [Clang 14.0.3 (https://github.com/llvm/llvm-project.git llvmorg-14.0.3-0-g1f914 on freebsd13 Type "help", "copyright", "credits" or "license" for more information.

import mirrorclock.bi mirrorclock.bi.mirrorClock() (2, 24) mirrorclock.bi.mirrorTime(4, 20) (7, 40) mirrorclock.bi.mirrorTime(5, 25) (6, 35) mirrorclock.bi.mirrorTime(11, 58) (12, 2) print(mirrorclock.bi.mirrorTime.doc)

Mirrors the time visually as it would seen on a wallclock.
    Returns a tuple as (hour, minute).

Parameters are hour and minute, 1<=hour<13, 0<=minute<60

``

Over the REST API, there is a single endpoint. Using GET, it mirrors the current system clock, using POST, a supplied time will be mirrored (set the host envvar accordingly): $ curl -XGET http://$host/api/v1/mirrortime {"status": "success", "string": "02:22", "hour": 2, "minute": 22} $ curl -XPOST -H 'Content-type: application/json' -d '{"hour": 4, "minute": 20}' http://$host/api/v1/mirrortime {"status": "success", "string": "07:40", "hour": 7, "minute": 40}

TODO

Add unit tests

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

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

Source Distribution

mirroclock-gczuczy-0.1.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

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

mirroclock_gczuczy-0.1-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file mirroclock-gczuczy-0.1.tar.gz.

File metadata

  • Download URL: mirroclock-gczuczy-0.1.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.13

File hashes

Hashes for mirroclock-gczuczy-0.1.tar.gz
Algorithm Hash digest
SHA256 face8159c04b72bc388b096e401a85531e6ed7d8c108d49ae430cdf7dcb9e9cc
MD5 43efee57b2db9f08c8281c184eabd35d
BLAKE2b-256 37f7693a7892bb67515c1a590d83a9f78fc894758aa5f847ebc317e0114e2dc9

See more details on using hashes here.

File details

Details for the file mirroclock_gczuczy-0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for mirroclock_gczuczy-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 95ea9d9217a3533bec26aada4548da1fc77da1ce633dcbdedd42ac3a5c365ac7
MD5 265cda878c5d0884b1bf56b66ce151ee
BLAKE2b-256 996040cf13776eebaa6930d4cf7baf88961d9735f10861d9b7c9d7c936dc7157

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