db_igtwitter module

class db_igtwitter.TwitterDB(config)

Bases: object

close_database(con)

Close database conection.

Parameters:

con (obj) – database object

connect_database()

Allow connection to database.

Returns:

con

Return type:

sqlite3 object

delete_post(event_id)
dict_factory(cursor, row)

Convert a row of a database to a dictionary using a query.

Parameters:
  • cursor – element that will represent a set of data determined by a query

  • row – database row

Returns:

d

Return type:

dictionary

get_post(select='*', where=None)

It makes a call to send_igtwitter and checks if an event has already been published previously by querying the database using the id to compare, finally it returns a list of events.

Parameters:
  • select="*" (str) – query instruction to select all elements

  • where=None (null) – query condition

Returns:

events

Return type:

list

init_database()

It checks if the database exists and if it does, it creates a table inside the database to store the events.

Returns:

0

Returns:

-1

Return type:

int

save_post(post_dict)

It allows to insert a new event in the table inside the database.

Parameters:

post_dict (dict) – post dictionary

Returns:

0

Returns:

-1

Return type:

int

update_post(post_dict, column, value)