Skip to main content

description

Project description

:rocket: App :facepunch:


Install

pip install iapp -U

Usage

  • Rest Api
import jieba
from iapp import App

pred1 = lambda **kwargs: kwargs['x'] + kwargs['y']
pred2 = lambda x=1, y=1: x - y
pred3 = lambda text='小米是家不错的公司': jieba.lcut(text)

app = App(verbose=True)
app.add_route("/", pred1, result_key='result')
app.add_route("/f1", pred1, version="1")
app.add_route("/f2", pred2, version="2")
app.add_route("/f3", pred3, version="3")

app.run()
  • Scheduler
from iapp.scheduler import Scheduler
    def task1(x):
        print(x)
        import logging
        import time
        logging.warning(f'Task1: {time.ctime()}')


    def task2():
        import logging
        import time
        logging.warning(f'Task2: {time.ctime()}')


    def task3():
        return 1 / 0


    def my_listener(event):
        if event.exception:
            print(event.traceback)
            print('任务出错了!!!!!!')
        else:
            print('任务照常运行...')


    scheduler = Scheduler()
    scheduler.add_job(task1, 'interval', seconds=3, args=('定时任务',))
    scheduler.add_job(task2, 'interval', seconds=5)
    scheduler.add_job(task3, 'interval', seconds=1)

    scheduler.add_listener(my_listener)
    scheduler.start()

    while 1:
        pass

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

iapp-2020.11.5.17.23.55.tar.gz (31.9 kB view details)

Uploaded Source

Built Distribution

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

iapp-2020.11.5.17.23.55-py3-none-any.whl (53.6 kB view details)

Uploaded Python 3

File details

Details for the file iapp-2020.11.5.17.23.55.tar.gz.

File metadata

  • Download URL: iapp-2020.11.5.17.23.55.tar.gz
  • Upload date:
  • Size: 31.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.42.0 CPython/3.6.8

File hashes

Hashes for iapp-2020.11.5.17.23.55.tar.gz
Algorithm Hash digest
SHA256 0d94ee39ffff532ac6adf8516f5bb810e70862d5a391a5a6f3fa2bae5542c157
MD5 80e1ea5070317252c2b25bdaea2f436b
BLAKE2b-256 69b785aca841abc106dfe5d7f96f889224b426561375678f0d37264e36cb374c

See more details on using hashes here.

File details

Details for the file iapp-2020.11.5.17.23.55-py3-none-any.whl.

File metadata

  • Download URL: iapp-2020.11.5.17.23.55-py3-none-any.whl
  • Upload date:
  • Size: 53.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.42.0 CPython/3.6.8

File hashes

Hashes for iapp-2020.11.5.17.23.55-py3-none-any.whl
Algorithm Hash digest
SHA256 74b86ccdb8c8bee63c9baddf06d9abfd87ada8c10d2866eea15472ee7a3b5ce5
MD5 57b726cb9185387ef073b2b6bb353e53
BLAKE2b-256 013ba3dcd732c5daaaa261e35b55fb4b71e0d2e072086d741307a6227124a478

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