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


Python db_sqlite3.connect函数代码示例

本文整理汇总了Python中squeakspace.proxy.server.db_sqlite3.connect函数的典型用法代码示例。如果您正苦于以下问题:Python connect函数的具体用法?Python connect怎么用?Python connect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: get_handler

def get_handler(environ):

    query = ht.parse_get_request(environ)
    cookies = ht.parse_cookies(environ)

    user_id = ht.get_required_cookie(cookies, "user_id")
    session_id = ht.get_required_cookie(cookies, "session_id")

    node_name = ht.get_required(query, "node_name")
    group_id = ht.get_required(query, "group_id")
    key_use = ht.get_required(query, "key_use")
    public_key_hash = ht.get_required(query, "public_key_hash")
    passphrase = ht.get_optional(query, "passphrase")

    conn = db.connect(config.db_path)
    try:
        c = db.cursor(conn)
        resp = db.read_group_key(c, user_id, session_id, node_name, group_id, key_use, public_key_hash, passphrase)

        raise ht.ok_json({"status": "ok", "resp": resp})

    except ex.SqueakException as e:
        raise ht.convert_squeak_exception(e)

    finally:
        db.close(conn)
开发者ID:eek6,项目名称:squeakspace,代码行数:26,代码来源:group_key.py

示例2: post_handler

def post_handler(environ):

    query = ht.parse_post_request(environ)
    cookies = ht.parse_cookies(environ)

    user_id = ht.get_required_cookie(cookies, 'user_id')
    session_id = ht.get_required_cookie(cookies, 'session_id')

    node_name = ht.get_required(query, 'node_name')
    url = ht.get_required(query, 'url')
    real_node_name = ht.get_required(query, 'real_node_name')
    fingerprint = ht.get_optional(query, 'fingerprint')

    conn = db.connect(config.db_path)
    try:
        c = db.cursor(conn)
        db.set_node_addr(c, user_id, session_id, node_name, url, real_node_name, fingerprint)

        db.commit(conn)

        raise ht.ok_json({'status' : 'ok'})

    except ex.SqueakException as e:
        raise ht.convert_squeak_exception(e)

    finally:
        db.close(conn)
开发者ID:eek6,项目名称:squeakspace,代码行数:27,代码来源:node_addr.py

示例3: delete_handler

def delete_handler(environ):

    query = ht.parse_post_request(environ)
    cookies = ht.parse_cookies(environ)

    user_id = ht.get_required_cookie(cookies, 'user_id')
    session_id = ht.get_required_cookie(cookies, 'session_id')

    group_id = ht.get_required(query, 'group_id')
    owner_id = ht.get_required(query, 'owner_id')
    node_name = ht.get_required(query, 'node_name')
    use = ht.get_required(query, 'use')


    conn = db.connect(config.db_path)
    try:
        c = db.cursor(conn)
        db.delete_local_group_access(c, user_id, session_id, group_id, owner_id, node_name, use)
        db.commit(conn)

        raise ht.ok_json({'status' : 'ok'})

    except ex.SqueakException as e:
        raise ht.convert_squeak_exception(e)

    finally:
        db.close(conn)
开发者ID:eek6,项目名称:squeakspace,代码行数:27,代码来源:group_access.py

示例4: post_handler

def post_handler(environ):

    query = ht.parse_post_request(environ)
    cookies = ht.parse_cookies(environ)

    user_id = ht.get_required_cookie(cookies, "user_id")
    session_id = ht.get_required_cookie(cookies, "session_id")

    group_id = ht.get_required(query, "group_id")
    owner_id = ht.get_required(query, "owner_id")
    node_name = ht.get_required(query, "node_name")
    key_use = ht.get_required(query, "key_use")
    public_key_hash = ht.get_required(query, "public_key_hash")

    conn = db.connect(config.db_path)
    try:
        c = db.cursor(conn)
        db.assign_local_group_key(c, user_id, session_id, group_id, owner_id, node_name, key_use, public_key_hash)
        db.commit(conn)

        raise ht.ok_json({"status": "ok"})

    except ex.SqueakException as e:
        raise ht.convert_squeak_exception(e)

    finally:
        db.close(conn)
开发者ID:eek6,项目名称:squeakspace,代码行数:27,代码来源:group_key.py

示例5: delete_handler

def delete_handler(environ):

    query = ht.parse_post_request(environ)
    cookies = ht.parse_cookies(environ)

    user_id = ht.get_required_cookie(cookies, 'user_id')
    session_id = ht.get_required_cookie(cookies, 'session_id')

    to_user = ht.get_required(query, 'to_user')
    node_name = ht.get_required(query, 'node_name')
    from_user_key_hash = ht.get_required(query, 'from_user_key_hash')

    conn = db.connect(config.db_path)
    try:
        c = db.cursor(conn)
        db.delete_local_message_access(c, user_id, session_id, to_user, node_name, from_user_key_hash)
        db.commit(conn)

        raise ht.ok_json({'status' : 'ok'})

    except ex.SqueakException as e:
        raise ht.convert_squeak_exception(e)

    finally:
        db.close(conn)
开发者ID:eek6,项目名称:squeakspace,代码行数:25,代码来源:message_access.py

示例6: get_handler

def get_handler(environ):

    query = ht.parse_get_request(environ)
    cookies = ht.parse_cookies(environ)

    user_id = ht.get_required_cookie(cookies, 'user_id')
    session_id = ht.get_required_cookie(cookies, 'session_id')

    node_name = ht.get_required(query, 'node_name')
    group_id = ht.get_required(query, 'group_id')
    owner_id = ht.get_required(query, 'owner_id')
    passphrase = ht.get_required(query, 'passphrase')

    conn = db.connect(config.db_path)
    try:
        c = db.cursor(conn)
        resp = db.read_group_quota(c, user_id, session_id, node_name, group_id, owner_id, passphrase)

        raise ht.ok_json({'status' : 'ok', 'resp' : resp})
        
    except ex.SqueakException as e:
        raise ht.convert_squeak_exception(e)

    finally:
        db.close(conn)
开发者ID:eek6,项目名称:squeakspace,代码行数:25,代码来源:group_quota.py

示例7: get_handler

def get_handler(environ):

    query = ht.parse_get_request(environ)
    cookies = ht.parse_cookies(environ)

    user_id = ht.get_required_cookie(cookies, 'user_id')
    session_id = ht.get_required_cookie(cookies, 'session_id')

    node_name = ht.get_required(query, 'node_name')
    to_user = ht.get_required(query, 'to_user')
    from_user_key_hash = ht.get_required(query, 'from_user_key_hash')
    passphrase = ht.get_optional(query, 'passphrase')

    conn = db.connect(config.db_path)
    try:
        c = db.cursor(conn)
        resp = db.read_max_message_size(c,
                user_id, session_id, node_name, to_user, from_user_key_hash, passphrase)

        raise ht.ok_json({'status' : 'ok', 'resp' : resp})
        
    except ex.SqueakException as e:
        raise ht.convert_squeak_exception(e)

    finally:
        db.close(conn)
开发者ID:eek6,项目名称:squeakspace,代码行数:26,代码来源:max_message_size.py

示例8: post_handler

def post_handler(environ):

    query = ht.parse_post_request(environ)
    cookies = ht.parse_cookies(environ)

    user_id = ht.get_required_cookie(cookies, 'user_id')
    session_id = ht.get_required_cookie(cookies, 'session_id')

    public_key_hash  = ht.get_required(query, 'public_key_hash')
    passphrase = ht.get_required(query, 'passphrase')
    expire_time = ht.convert_int(ht.get_optional(query, 'expire_time'), 'expire_time')

    conn = db.connect(config.db_path)
    try:
        c = db.cursor(conn)
        db.cache_passphrase(c, user_id, session_id, public_key_hash, passphrase, expire_time)
        db.commit(conn)

        raise ht.ok_json({'status' : 'ok'})

    except ex.SqueakException as e:
        raise ht.convert_squeak_exception(e)

    finally:
        db.close(conn)
开发者ID:elpassassin,项目名称:squeakspace,代码行数:25,代码来源:passphrase.py

示例9: post_handler

def post_handler(environ):

    query = ht.parse_post_request(environ)
    cookies = ht.parse_cookies(environ)

    user_id = ht.get_required_cookie(cookies, 'user_id')
    session_id = ht.get_required_cookie(cookies, 'session_id')

    key_type = ht.get_required(query, 'key_type')
    public_key = ht.get_required(query, 'public_key')
    revoke_date = ht.get_optional(query, 'revoke_date')

    conn = db.connect(config.db_path)
    try:
        c = db.cursor(conn)
        public_key_hash = db.import_public_key(c, user_id, session_id, key_type, public_key, revoke_date)
        db.commit(conn)

        raise ht.ok_json({'status' : 'ok', 'public_key_hash' : public_key_hash})

    except ex.SqueakException as e:
        raise ht.convert_squeak_exception(e)

    finally:
        db.close(conn)
开发者ID:eek6,项目名称:squeakspace,代码行数:25,代码来源:public_key.py

示例10: get_handler

def get_handler(environ):

    query = ht.parse_get_request(environ)
    cookies = ht.parse_cookies(environ)

    user_id = ht.get_required_cookie(cookies, 'user_id')
    session_id = ht.get_required_cookie(cookies, 'session_id')

    node_name = ht.get_required(query, 'node_name')
    group_id = ht.get_required(query, 'group_id')
    owner_id = ht.get_required(query, 'owner_id')
    post_id = ht.get_required(query, 'post_id')
    passphrase = ht.get_optional(query, 'passphrase')
    decrypt_post = ht.convert_bool(ht.get_optional(query, 'decrypt_post'), 'decrypt_post')

    conn = db.connect(config.db_path)
    try:
        c = db.cursor(conn)
        resp, validation = db.read_post(c,
                user_id, session_id, node_name, group_id, owner_id, post_id,
                passphrase, decrypt_post)

        raise ht.ok_json({'status' : 'ok', 'resp' : resp, 'validation' : validation})
        
    except ex.SqueakException as e:
        raise ht.convert_squeak_exception(e)

    finally:
        db.close(conn)
开发者ID:eek6,项目名称:squeakspace,代码行数:29,代码来源:post.py

示例11: post_handler

def post_handler(environ):

    query = ht.parse_post_request(environ)
    cookies = ht.parse_cookies(environ)

    user_id = ht.get_required_cookie(cookies, 'user_id')
    session_id = ht.get_required_cookie(cookies, 'session_id')

    method  = ht.get_required(query, 'method')
    password  = ht.get_optional(query, 'password')
    public_key_hash  = ht.get_optional(query, 'public_key_hash')

    conn = db.connect(config.db_path)
    try:
        c = db.cursor(conn)
        db.set_password(c, user_id, session_id, method, password, public_key_hash)
        db.commit(conn)

        raise ht.ok_json({'status' : 'ok'})

    except ex.SqueakException as e:
        raise ht.convert_squeak_exception(e)

    finally:
        db.close(conn)
开发者ID:eek6,项目名称:squeakspace,代码行数:25,代码来源:password.py

示例12: get_handler

def get_handler(environ):

    query = ht.parse_get_request(environ)
    cookies = ht.parse_cookies(environ)

    user_id = ht.get_required_cookie(cookies, 'user_id')
    session_id = ht.get_required_cookie(cookies, 'session_id')

    node_name = ht.get_required(query, 'node_name')
    message_id = ht.get_required(query, 'message_id')
    public_key_hash = ht.get_required(query, 'public_key_hash')
    passphrase = ht.get_optional(query, 'passphrase')
    to_key_passphrase = ht.get_optional(query, 'to_key_passphrase')
    decrypt_message = ht.convert_bool(ht.get_optional(query, 'decrypt_message'), 'decrypt_message')

    conn = db.connect(config.db_path)
    try:
        c = db.cursor(conn)
        resp, validation = db.read_message(c, user_id, session_id, node_name, message_id,
                                           public_key_hash, passphrase,
                                           to_key_passphrase, decrypt_message)

        raise ht.ok_json({'status' : 'ok',
                          'resp' : resp,
                          'validation' : validation})
        
    except ex.SqueakException as e:
        raise ht.convert_squeak_exception(e)

    finally:
        db.close(conn)
开发者ID:eek6,项目名称:squeakspace,代码行数:31,代码来源:message.py

示例13: get_handler

def get_handler(environ):

    query = ht.parse_get_request(environ)
    cookies = ht.parse_cookies(environ)

    user_id = ht.get_required_cookie(cookies, 'user_id')
    session_id = ht.get_required_cookie(cookies, 'session_id')

    node_name = ht.get_required(query, 'node_name')
    group_id = ht.get_required(query, 'group_id')
    owner_id = ht.get_required(query, 'owner_id')
    start_time = ht.convert_int(ht.get_optional(query, 'start_time'), 'start_time')
    end_time = ht.convert_int(ht.get_optional(query, 'end_time'), 'end_time')
    max_records = ht.convert_int(ht.get_optional(query, 'max_records'), 'max_records')
    order = ht.get_optional(query, 'order')
    passphrase = ht.get_optional(query, 'passphrase')

    conn = db.connect(config.db_path)
    try:
        c = db.cursor(conn)
        resp = db.read_post_list(c, user_id, session_id,
                                 node_name, group_id, owner_id,
                                 start_time, end_time, max_records, order, passphrase)

        raise ht.ok_json({'status' : 'ok', 'resp' : resp})
        
    except ex.SqueakException as e:
        raise ht.convert_squeak_exception(e)

    finally:
        db.close(conn)
开发者ID:eek6,项目名称:squeakspace,代码行数:31,代码来源:post_list.py

示例14: post_handler

def post_handler(environ):

    query = ht.parse_post_request(environ)
    cookies = ht.parse_cookies(environ)

    user_id = ht.get_required_cookie(cookies, 'user_id')
    session_id = ht.get_required_cookie(cookies, 'session_id')

    node_name = ht.get_required(query, 'node_name')
    new_size = ht.convert_int(ht.get_required(query, 'new_size'), 'new_size')
    when_space_exhausted = ht.get_required(query, 'when_space_exhausted')
    public_key_hash = ht.get_required(query, 'public_key_hash')
    passphrase = ht.get_optional(query, 'passphrase')

    conn = db.connect(config.db_path)
    try:
        c = db.cursor(conn)
        resp = db.change_message_quota(c, user_id, session_id,
                                       node_name, new_size, when_space_exhausted,
                                       public_key_hash, passphrase)
        db.commit(conn)

        raise ht.ok_json({'status' : 'ok', 'resp' : resp})

    except ex.SqueakException as e:
        raise ht.convert_squeak_exception(e)

    finally:
        db.close(conn)
开发者ID:eek6,项目名称:squeakspace,代码行数:29,代码来源:message_quota.py

示例15: delete_handler

def delete_handler(environ):

    query = ht.parse_post_request(environ)
    cookies = ht.parse_cookies(environ)

    user_id = ht.get_required_cookie(cookies, 'user_id')
    session_id = ht.get_required_cookie(cookies, 'session_id')

    other_user_id = ht.get_required(query, 'other_user_id')
    node_name = ht.get_required(query, 'node_name')
    public_key_hash = ht.get_required(query, 'public_key_hash')

    conn = db.connect(config.db_path)
    try:
        c = db.cursor(conn)
        db.delete_other_user_key(c, user_id, session_id, other_user_id, node_name, public_key_hash)
        db.commit(conn)

        raise ht.ok_json({'status' : 'ok'})

    except ex.SqueakException as e:
        raise ht.convert_squeak_exception(e)

    finally:
        db.close(conn)
开发者ID:eek6,项目名称:squeakspace,代码行数:25,代码来源:other_user_key.py


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