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


Python sqlite3.html方法代码示例

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


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

示例1: _instrument

# 需要导入模块: import sqlite3 [as 别名]
# 或者: from sqlite3 import html [as 别名]
def _instrument(self, **kwargs):
        """Integrate with SQLite3 Python library.
        https://docs.python.org/3/library/sqlite3.html
        """
        tracer_provider = kwargs.get("tracer_provider")

        tracer = get_tracer(__name__, __version__, tracer_provider)

        dbapi.wrap_connect(
            tracer,
            sqlite3,
            "connect",
            self._DATABASE_COMPONENT,
            self._DATABASE_TYPE,
            self._CONNECTION_ATTRIBUTES,
        ) 
开发者ID:open-telemetry,项目名称:opentelemetry-python,代码行数:18,代码来源:__init__.py

示例2: adapt_datetime

# 需要导入模块: import sqlite3 [as 别名]
# 或者: from sqlite3 import html [as 别名]
def adapt_datetime(ts):
    # http://docs.python.org/2/library/sqlite3.html#registering-an-adapter-callable
    return time.mktime(ts.timetuple()) 
开发者ID:primaeval,项目名称:script.tvguide.fullscreen,代码行数:5,代码来源:playwithchannel.py

示例3: adapt_datetime

# 需要导入模块: import sqlite3 [as 别名]
# 或者: from sqlite3 import html [as 别名]
def adapt_datetime(ts):
        # http://docs.python.org/2/library/sqlite3.html#registering-an-adapter-callable
        return time.mktime(ts.timetuple()) 
开发者ID:primaeval,项目名称:script.tvguide.fullscreen,代码行数:5,代码来源:source.py

示例4: get_url

# 需要导入模块: import sqlite3 [as 别名]
# 或者: from sqlite3 import html [as 别名]
def get_url(self,url):
        #headers = {'user-agent': 'Mozilla/5.0 (BB10; Touch) AppleWebKit/537.10+ (KHTML, like Gecko) Version/10.0.9.2372 Mobile Safari/537.10+'}
        headers = {'user-agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1'}
        try:
            r = requests.get(url,headers=headers)
            html = HTMLParser.HTMLParser().unescape(r.content.decode('utf-8'))
            return html
        except:
            return '' 
开发者ID:primaeval,项目名称:script.tvguide.fullscreen,代码行数:11,代码来源:source.py

示例5: generate_insert_sqlstr_multivalue_tuple

# 需要导入模块: import sqlite3 [as 别名]
# 或者: from sqlite3 import html [as 别名]
def generate_insert_sqlstr_multivalue_tuple(table_name, column_name_list, column_value_lists):
    # Formulate the sql string and value tuple for batch sql insert queries
    # The key point is to use executemany function
    # https://docs.python.org/2/library/sqlite3.html
    sqlstr = 'INSERT INTO %s( %s ) VALUES ( %s )' % (table_name, ','.join(column_name_list),
                                                     ','.join(['?'] * len(column_name_list)))
    return (sqlstr, column_value_lists) 
开发者ID:osssanitizer,项目名称:osspolice,代码行数:9,代码来源:sqlite_util.py

示例6: GetValues

# 需要导入模块: import sqlite3 [as 别名]
# 或者: from sqlite3 import html [as 别名]
def GetValues(self, table_names, column_names, condition):
    """Retrieves values from a table.

    Args:
      table_names (list[str]): table names.
      column_names (list[str]): column names.
      condition (str): query condition such as
          "log_source == 'Application Error'".

    Yields:
      sqlite3.row: row.

    Raises:
      RuntimeError: if the database is not opened.
    """
    if not self._connection:
      raise RuntimeError('Cannot retrieve values database not opened.')

    if condition:
      condition = ' WHERE {0:s}'.format(condition)

    sql_query = 'SELECT {1:s} FROM {0:s}{2:s}'.format(
        ', '.join(table_names), ', '.join(column_names), condition)

    self._cursor.execute(sql_query)

    # TODO: have a look at https://docs.python.org/2/library/
    # sqlite3.html#sqlite3.Row.
    for row in self._cursor:
      yield {
          column_name: row[column_index]
          for column_index, column_name in enumerate(column_names)} 
开发者ID:log2timeline,项目名称:plaso,代码行数:34,代码来源:winevt_rc.py

示例7: __init__

# 需要导入模块: import sqlite3 [as 别名]
# 或者: from sqlite3 import html [as 别名]
def __init__(self, *args, **kwargs):
        # by default [py]sqlite3 checks that object methods are run in the same
        # thread as the one that created the Connection or Cursor. If it finds
        # they are not then an exception is raised.
        # <https://docs.python.org/2/library/sqlite3.html#multithreading>
        # Luckily for us we can switch this check off.
        kwargs['check_same_thread'] = False
        super(Connection, self).__init__(*args, **kwargs) 
开发者ID:OpenSight,项目名称:janus-cloud,代码行数:10,代码来源:gsqlite3.py

示例8: __init__

# 需要导入模块: import sqlite3 [as 别名]
# 或者: from sqlite3 import html [as 别名]
def __init__(self, databaseFilePath):
        print("Intializing database at {}".format(databaseFilePath))

        self.dbConnection = sqlite3.connect(databaseFilePath)

        # This gives us the ability to access results by column name
        # See https://docs.python.org/3/library/sqlite3.html#row-objects
        self.dbConnection.row_factory = sqlite3.Row

        self.initializeDatabaseTables() 
开发者ID:makuto,项目名称:Liked-Saved-Image-Downloader,代码行数:12,代码来源:LikedSavedDatabase.py


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