: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
Metadata
Release files for iapp 2020.11.5.17.26.13
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| iapp-2020.11.5.17.26.13.tar.gz | 31.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| iapp-2020.11.5.17.26.13-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 85.5 kB
Release files / iapp-2020.11.5.17.26.13.tar.gz
| Download URL | iapp-2020.11.5.17.26.13.tar.gz |
|---|---|
| Size | 31.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
43df045b008b4098849201658893a23b845d87f91ab0a3d1476c265ed690a7da
|
|
BLAKE2b-256 checksum How to use checksums |
e456d27aa840e60957e26b05a2eb6489fa90e8afdaaaa99d8b80ff961407eba3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / iapp-2020.11.5.17.26.13-py3-none-any.whl
| Download URL | iapp-2020.11.5.17.26.13-py3-none-any.whl |
|---|---|
| Size | 53.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
825ccf5991d610dd86a914910949dbf77fd86be6c77391193199e8d1184cd62d
|
|
BLAKE2b-256 checksum How to use checksums |
ac64687682391b114af41b1a51c654b8a25fae8feafb725a2c0ecf853ad9f1e7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Security for iapp 2020.11.5.17.26.13
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.