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


Python Service.deregister方法代码示例

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


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

示例1: attack

# 需要导入模块: from intermine.webservice import Service [as 别名]
# 或者: from intermine.webservice.Service import deregister [as 别名]
    def attack(self):
        username = "user-weapon-{0}@noreply.intermine.org".format(self.ident)
        password = "yolo"

        try:
            s = Service(self.service.root, username, password)
            s.deregister(s.get_deregistration_token())
            self.counter.add(3)
        except:
            pass

        s = self.service.register(username, password)
        self.LOG.debug("Registered user " + username)
        self.counter.add(1)

        c = 0
        classes = s.model.classes.values()
        self.counter.add(1)

        classkeys = s._get_json('/classkeys')['classes']
        self.counter.add(1)

        while c == 0:
            table = random.choice(classes)
            if not (table.has_id and table.name in classkeys):
                continue
            query = s.query(table.name).select(classkeys[table.name][0])

            c = query.count()
            self.counter.add(1)

        n = random.randint(1, min(100, c))
        members = random.sample(map(lambda r: r[0], query.rows()), n)
        self.counter.add(1)

        self.LOG.debug("Will construct list of %s with: %r", table.name, members)

        with s.list_manager() as lm:
            l = lm.create_list(members, table.name)
            self.LOG.debug('Created list %s, size: %d', l.name, l.size)
            self.counter.add(1)

        try:
            s.deregister(s.get_deregistration_token())
            self.counter.add(2)
        except:
            pass
开发者ID:alexkalderimis,项目名称:death-by-snoo-snoo,代码行数:49,代码来源:weapons.py

示例2: test_user_registration

# 需要导入模块: from intermine.webservice import Service [as 别名]
# 或者: from intermine.webservice.Service import deregister [as 别名]
    def test_user_registration(self):
        username = 'mayfly-{0}@noreply.intermine.org'.format(uuid.uuid4())
        password = 'yolo'
        try:
            s = Service(self.SERVICE.root, username, password)
            s.deregister(s.get_deregistration_token())
        except:
            pass

        s = self.SERVICE.register(username, password)

        self.assertEqual(s.root, self.SERVICE.root)
        self.assertEqual(2, len(s.get_all_lists()))

        drt = s.get_deregistration_token()
        s.deregister(drt)

        self.assertRaises(WebserviceError, s.get_all_lists)
开发者ID:intermine,项目名称:intermine-ws-client.py,代码行数:20,代码来源:live_results.py


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