本文整理汇总了Python中squeakspace.common.util_client.encode函数的典型用法代码示例。如果您正苦于以下问题:Python encode函数的具体用法?Python encode怎么用?Python encode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了encode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_group
def create_group(self, user_id, session_id, node_name, group_id,
post_access, read_access, delete_access,
posting_key_hash, reading_key_hash, delete_key_hash,
quota_allocated, when_space_exhausted,
max_post_size,
public_key_hash, passphrase=None):
method = 'POST'
path = '/proxy/group'
body = uc.encode(
{'node_name' : node_name,
'group_id' : group_id,
'post_access' : post_access,
'read_access' : read_access,
'delete_access' : delete_access,
'posting_key_hash' : posting_key_hash,
'reading_key_hash' : reading_key_hash,
'delete_key_hash' : delete_key_hash,
'quota_allocated' : quota_allocated,
'when_space_exhausted' : when_space_exhausted,
'max_post_size' : max_post_size,
'public_key_hash' : public_key_hash,
'passphrase' : passphrase})
cookies = co.SimpleCookie({'user_id' : user_id, 'session_id' : session_id})
return self.send_and_getter.send_and_get(self.conn, method, path, body=body, cookies=cookies)[0]
示例2: read_version
def read_version(self, node_name):
method = 'GET'
url = '/version?' + uc.encode(
{'node_name' : node_name})
return self.send_and_getter.send_and_get(self.conn, method, url)
示例3: create_group
def create_group(
self,
timestamp, node_name, group_id, owner_id,
post_access, read_access, delete_access,
posting_key_type, posting_pub_key,
reading_key_type, reading_pub_key,
delete_key_type, delete_pub_key,
quota_allocated, when_space_exhausted,
max_post_size,
public_key_hash, signature):
method = 'POST'
url = '/group'
body = uc.encode(
{'timestamp' : timestamp,
'node_name' : node_name,
'group_id' : group_id,
'owner_id' : owner_id,
'post_access' : post_access,
'read_access' : read_access,
'delete_access' : delete_access,
'posting_key_type' : posting_key_type,
'posting_pub_key' : posting_pub_key,
'reading_key_type' : reading_key_type,
'reading_pub_key' : reading_pub_key,
'delete_key_type' : delete_key_type,
'delete_pub_key' : delete_pub_key,
'quota_allocated' : quota_allocated,
'when_space_exhausted' : when_space_exhausted,
'max_post_size' : max_post_size,
'public_key_hash' : public_key_hash,
'signature' : signature})
return self.send_and_getter.send_and_get(self.conn, method, url, body)
示例4: create_user
def create_user(self, node_name, user_id,
key_type, public_key, public_key_hash, revoke_date,
default_message_access, when_mail_exhausted,
quota_size, mail_quota_size,
max_message_size,
user_class, auth_token):
method = 'POST'
url = '/user'
body = uc.encode(
{'node_name' : node_name,
'user_id' : user_id,
'key_type' : key_type,
'public_key' : public_key,
'public_key_hash' : public_key_hash,
'revoke_date' : revoke_date,
'default_message_access' : default_message_access,
'when_mail_exhausted' : when_mail_exhausted,
'quota_size' : quota_size,
'mail_quota_size' : mail_quota_size,
'max_message_size' : max_message_size,
'user_class' : user_class,
'auth_token' : auth_token})
return self.send_and_getter.send_and_get(self.conn, method, url, body)
示例5: query_user
def query_user(self, node_name, user_id):
method = 'GET'
url = '/query-user?' + uc.encode(
{'node_name' : node_name,
'user_id' : user_id})
return self.send_and_getter.send_and_get(self.conn, method, url)
示例6: read_node_addr
def read_node_addr(self, user_id, session_id, node_name):
method = 'GET'
path = '/local/node-addr?' + uc.encode(
{'node_name' : node_name})
cookies = co.SimpleCookie({'user_id' : user_id, 'session_id' : session_id})
return self.send_and_getter.send_and_get(self.conn, method, path, body=None, cookies=cookies)[0]
示例7: read_quota_available
def read_quota_available(self, node_name, user_class):
method = 'GET'
url = '/quota-available?' + uc.encode(
{'node_name' : node_name,
'user_class' : user_class})
return self.send_and_getter.send_and_get(self.conn, method, url)
示例8: list_user_keys
def list_user_keys(self, user_id, session_id, node_name=None):
method = 'GET'
path = '/local/list-user-keys?' + uc.encode(
{'node_name' : node_name})
cookies = co.SimpleCookie({'user_id' : user_id, 'session_id' : session_id})
return self.send_and_getter.send_and_get(self.conn, method, path, body=None, cookies=cookies)[0]
示例9: read_public_key
def read_public_key(self, user_id, session_id, public_key_hash):
method = 'GET'
path = '/local/public-key?' + uc.encode(
{'public_key_hash' : public_key_hash})
cookies = co.SimpleCookie({'user_id' : user_id, 'session_id' : session_id})
return self.send_and_getter.send_and_get(self.conn, method, path, body=None, cookies=cookies)[0]
示例10: delete_node_addr
def delete_node_addr(self, user_id, session_id, node_name):
method = 'DELETE'
path = '/local/node-addr'
body = uc.encode(
{'node_name' : node_name})
cookies = co.SimpleCookie({'user_id' : user_id, 'session_id' : session_id})
return self.send_and_getter.send_and_get(self.conn, method, path, body=body, cookies=cookies)[0]
示例11: query_user
def query_user(self, user_id, session_id, node_name, other_user_id):
method = 'GET'
path = '/proxy/query-user?' + uc.encode(
{'node_name' : node_name,
'other_user_id' : other_user_id})
cookies = co.SimpleCookie({'user_id' : user_id, 'session_id' : session_id})
return self.send_and_getter.send_and_get(self.conn, method, path, body=None, cookies=cookies)[0]
示例12: delete_public_key
def delete_public_key(self, user_id, session_id, public_key_hash):
method = 'DELETE'
path = '/local/public-key'
body = uc.encode(
{'public_key_hash' : public_key_hash})
cookies = co.SimpleCookie({'user_id' : user_id, 'session_id' : session_id})
return self.send_and_getter.send_and_get(self.conn, method, path, body=body, cookies=cookies)[0]
示例13: create_local_user
def create_local_user(self, user_id, password):
method = 'POST'
path = '/local/user'
body = uc.encode(
{'user_id' : user_id,
'password' : password})
return self.send_and_getter.send_and_get(self.conn, method, path, body=body, cookies=None)
示例14: read_quota_available
def read_quota_available(self, user_id, session_id, node_name, user_class):
method = 'GET'
path = '/proxy/quota-available?' + uc.encode(
{'node_name' : node_name,
'user_class' : user_class})
cookies = co.SimpleCookie({'user_id' : user_id, 'session_id' : session_id})
return self.send_and_getter.send_and_get(self.conn, method, path, body=None, cookies=cookies)[0]
示例15: read_private_key
def read_private_key(self, user_id, session_id, public_key_hash, only_public_part=None, allow_private_user_key=None):
method = 'GET'
path = '/local/private-key?' + uc.encode(
{'public_key_hash' : public_key_hash,
'only_public_part' : only_public_part,
'allow_private_user_key' : allow_private_user_key})
cookies = co.SimpleCookie({'user_id' : user_id, 'session_id' : session_id})
return self.send_and_getter.send_and_get(self.conn, method, path, body=None, cookies=cookies)[0]