Python sqlite3.html() Examples

The following are 13 code examples of sqlite3.html(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module sqlite3 , or try the search function .
Example #1
Source File: __init__.py    From opentelemetry-python with Apache License 2.0 6 votes vote down vote up
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,
        ) 
Example #2
Source File: playwithchannel.py    From script.tvguide.fullscreen with GNU General Public License v2.0 5 votes vote down vote up
def adapt_datetime(ts):
    # http://docs.python.org/2/library/sqlite3.html#registering-an-adapter-callable
    return time.mktime(ts.timetuple()) 
Example #3
Source File: playwithchannel.py    From script.tvguide.fullscreen with GNU General Public License v2.0 5 votes vote down vote up
def adapt_datetime(ts):
    # http://docs.python.org/2/library/sqlite3.html#registering-an-adapter-callable
    return time.mktime(ts.timetuple()) 
Example #4
Source File: playwith.py    From script.tvguide.fullscreen with GNU General Public License v2.0 5 votes vote down vote up
def adapt_datetime(ts):
    # http://docs.python.org/2/library/sqlite3.html#registering-an-adapter-callable
    return time.mktime(ts.timetuple()) 
Example #5
Source File: playwith.py    From script.tvguide.fullscreen with GNU General Public License v2.0 5 votes vote down vote up
def adapt_datetime(ts):
    # http://docs.python.org/2/library/sqlite3.html#registering-an-adapter-callable
    return time.mktime(ts.timetuple()) 
Example #6
Source File: source.py    From script.tvguide.fullscreen with GNU General Public License v2.0 5 votes vote down vote up
def adapt_datetime(ts):
        # http://docs.python.org/2/library/sqlite3.html#registering-an-adapter-callable
        return time.mktime(ts.timetuple()) 
Example #7
Source File: source.py    From script.tvguide.fullscreen with GNU General Public License v2.0 5 votes vote down vote up
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 '' 
Example #8
Source File: source.py    From script.tvguide.fullscreen with GNU General Public License v2.0 5 votes vote down vote up
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 '' 
Example #9
Source File: sqlite_util.py    From osspolice with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #10
Source File: winevt_rc.py    From plaso with Apache License 2.0 5 votes vote down vote up
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)} 
Example #11
Source File: gsqlite3.py    From janus-cloud with GNU Affero General Public License v3.0 5 votes vote down vote up
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) 
Example #12
Source File: LikedSavedDatabase.py    From Liked-Saved-Image-Downloader with MIT License 5 votes vote down vote up
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() 
Example #13
Source File: source.py    From FTV-Guide-Repo with GNU General Public License v2.0 5 votes vote down vote up
def adapt_datetime(ts):
        # http://docs.python.org/2/library/sqlite3.html#registering-an-adapter-callable
        return time.mktime(ts.timetuple())