本文整理汇总了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)
示例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()
示例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')