当前位置: 首页>>代码示例>>Python>>正文


Python MyGengo.getAccountStats方法代码示例

本文整理汇总了Python中mygengo.MyGengo.getAccountStats方法的典型用法代码示例。如果您正苦于以下问题:Python MyGengo.getAccountStats方法的具体用法?Python MyGengo.getAccountStats怎么用?Python MyGengo.getAccountStats使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mygengo.MyGengo的用法示例。


在下文中一共展示了MyGengo.getAccountStats方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: gengo_authentication

# 需要导入模块: from mygengo import MyGengo [as 别名]
# 或者: from mygengo.MyGengo import getAccountStats [as 别名]
    def gengo_authentication(self, cr, uid, context=None):
        ''' 
        This method tries to open a connection with Gengo. For that, it uses the Public and Private
        keys that are linked to the company (given by Gengo on subscription). It returns a tuple with
         * as first element: a boolean depicting if the authentication was a success or not
         * as second element: the connection, if it was a success, or the error message returned by 
            Gengo when the connection failed.
            This error message can either be displayed in the server logs (if the authentication was called 
            by the cron) or in a dialog box (if requested by the user), thus it's important to return it 
            translated.
        '''

        user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
        if not user.company_id.gengo_public_key or not user.company_id.gengo_private_key:
            return (False, _("Invalid Gengo configuration. Gengo authentication `Public Key` or `Private Key` is missing. Complete Gengo authentication parameters under `Settings > Companies > Gengo Parameters`."))
        try:
            gengo = MyGengo(
                public_key=user.company_id.gengo_public_key.encode('ascii'),
                private_key=user.company_id.gengo_private_key.encode('ascii'),
                sandbox=True,
            )
            gengo.getAccountStats()

            return (True, gengo)
        except Exception, e:
            return (False, _("Gengo Connection Error\n%s") %e)
开发者ID:ShantiSR,项目名称:openerp-addons,代码行数:28,代码来源:base_gengo_translations.py

示例2: MyGengo

# 需要导入模块: from mygengo import MyGengo [as 别名]
# 或者: from mygengo.MyGengo import getAccountStats [as 别名]
# -*- coding: utf-8 -*-
#!/usr/bin/python

from mygengo import MyGengo

# Get an instance of MyGengo to work with...
gengo = MyGengo(
    public_key = '[email protected]#OOsAeR4z49IX|j}#dwyliMp2RIq1vM9OIKq-K#{mg~sVBUX^91',
    private_key = '~Q9hI|sV(I^iX7|8WQ=l5=CvUmEWx3[=c5ms09|$JIuT-$aiTIYkS4~1F7^C9dw3',
    sandbox = False, # possibly false, depending on your dev needs
)

# Print the account stats...
print gengo.getAccountStats()
开发者ID:fvbock,项目名称:mygengo-python,代码行数:16,代码来源:getAccountStats.py

示例3: test_getAccountStats

# 需要导入模块: from mygengo import MyGengo [as 别名]
# 或者: from mygengo.MyGengo import getAccountStats [as 别名]
	def test_getAccountStats(self):
		myGengo = MyGengo(public_key = public_key, private_key = private_key, sandbox = SANDBOX)
		stats = myGengo.getAccountStats()
		self.assertEqual(stats['opstat'], 'ok')
开发者ID:fvbock,项目名称:mygengo-python,代码行数:6,代码来源:tests.py


注:本文中的mygengo.MyGengo.getAccountStats方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。