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
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
iapp-2020.11.5.17.23.55.tar.gz
(31.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d94ee39ffff532ac6adf8516f5bb810e70862d5a391a5a6f3fa2bae5542c157
|
|
| MD5 |
80e1ea5070317252c2b25bdaea2f436b
|
|
| BLAKE2b-256 |
69b785aca841abc106dfe5d7f96f889224b426561375678f0d37264e36cb374c
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74b86ccdb8c8bee63c9baddf06d9abfd87ada8c10d2866eea15472ee7a3b5ce5
|
|
| MD5 |
57b726cb9185387ef073b2b6bb353e53
|
|
| BLAKE2b-256 |
013ba3dcd732c5daaaa261e35b55fb4b71e0d2e072086d741307a6227124a478
|