本文整理汇总了Python中smugpy.SmugMug.service_ping方法的典型用法代码示例。如果您正苦于以下问题:Python SmugMug.service_ping方法的具体用法?Python SmugMug.service_ping怎么用?Python SmugMug.service_ping使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类smugpy.SmugMug
的用法示例。
在下文中一共展示了SmugMug.service_ping方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestApi
# 需要导入模块: from smugpy import SmugMug [as 别名]
# 或者: from smugpy.SmugMug import service_ping [as 别名]
class TestApi(unittest.TestCase):
def setUp(self):
self.smugmug = SmugMug(api_key=API_KEY, api_version='1.2.2', app_name='TestApp')
def test_ping(self):
rsp = self.smugmug.service_ping()
self.assertEqual(rsp['stat'], 'ok')
def test_dynamic_method(self):
self.smugmug.login_anonymously()
rsp = self.smugmug.albums_get(NickName='test')
self.assertEqual(rsp['method'], 'smugmug.albums.get')
self.smugmug.reset_auth()
def test_authorize(self):
expected = 'http://api.smugmug.com/services/oauth/authorize.mg?oauth_token=ABC&Access=Public&Permissions=Read'
self.smugmug.set_oauth_token('ABC','123')
url = self.smugmug.authorize(access='Public', perm='Read')
self.assertEqual(url, expected)
self.smugmug.reset_auth()
def test_failed_api(self):
if sys.version_info < (2, 7):
self.assertRaises(SmugMugException, lambda: self.smugmug.bad_apimethod())
else:
with self.assertRaises(SmugMugException):
self.smugmug.bad_apimethod()