Ejemplo n.º 1
0
def add_entry(title: str, datetime: pendulum.datetime) -> None:
    """Adds an entry to the database.

    Args:
        title (str): the entry's URL
        datetime (pendulum.datetime): the date of the entry

    """
    datetime = datetime.in_tz('UTC')
    conn = sqlite3.connect('rss.db')
    c = conn.cursor()
    c.execute("""insert into entries values
        (?, ?, ?, ?)""", (title, datetime.year, datetime.month, datetime.day))
    conn.commit()
    conn.close()
Ejemplo n.º 2
0
def add_entry(url: str, datetime: pendulum.datetime):
    """Adds an entry to the database.

    Args:
        url (str): the entry's URL
        datetime (pendulum.datetime): the date of the entry

    Returns:
        None

    """
    datetime = datetime.in_tz('UTC')
    conn = sqlite3.connect('rss.db')
    c = conn.cursor()
    c.execute(
        """insert into entries values
        (?, ?, ?, ?, ?)""",
        (url, datetime.year, datetime.month, datetime.day, datetime.hour))
    conn.commit()
    conn.close()
    return