本文整理匯總了Python中intermine.webservice.Service.get_deregistration_token方法的典型用法代碼示例。如果您正苦於以下問題:Python Service.get_deregistration_token方法的具體用法?Python Service.get_deregistration_token怎麽用?Python Service.get_deregistration_token使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類intermine.webservice.Service
的用法示例。
在下文中一共展示了Service.get_deregistration_token方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: attack
# 需要導入模塊: from intermine.webservice import Service [as 別名]
# 或者: from intermine.webservice.Service import get_deregistration_token [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
示例2: test_user_registration
# 需要導入模塊: from intermine.webservice import Service [as 別名]
# 或者: from intermine.webservice.Service import get_deregistration_token [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)