Skip to main content

James Iter's common library by python.

Project description

建议

  • 基于各主干的枝叶状态码从50开始,如412主干,则用户自定义枝叶状态码由41250起。

示例

  • 枝叶状态码合并
own_state_branch = {
        '41250': {
            'code': '41250',
            'zh-cn': '账密不匹配'
            }
        }
ji.state_code.index_state['branch'] = dict(ji.state_code.index_state['branch'], **own_state_branch)
print json.dumps(ji.Commons.exchange_state(41250), ensure_ascii=False)

{
    "code": "412",
    "zh-cn": "先决条件失败",
    "en-us": "Precondition Failed",
    "sub": {
        "zh-cn": "账密不匹配",
        "code": "41250"
    }
}

路由器示例

from jimit.router import Router, router_table
from jimit.ji_time import JITime
import unittest

reload(sys)
sys.setdefaultencoding('utf8')

# 首先配置路由表
router_table['today'] = JITime.today

'''
:param action: 目标路由地址
:param content: 传给目标的参数内容(content可以是一个字典,这样对于给目标传参更为灵活;示例: {'name': 'James', 'gender': 'M'})
'''
print Router.launcher(action='today', content='-')

Project details


Download files

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

Files for jimit, version 0.37
Filename, size File type Python version Upload date Hashes
Filename, size jimit-0.37.tar.gz (8.7 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page