module rss.rss_database

Inheritance diagram of pyrsslocal.rss.rss_database

Short summary

module pyrsslocal.rss.rss_database

description of a RSS stream

source on GitHub

Classes

class

truncated documentation

DatabaseRSS

database specific to RSS

Static Methods

staticmethod

truncated documentation

getday

return the same datetime but with no time

getdayn

return the same datetime but with no time

schema_table

returns the schema for a specific table

Methods

method

truncated documentation

__init__

constructor

__str__

usual

create_missing_table

creates the missing tables

enumerate_blogs

Enumerates all the blogs from the database.

enumerate_latest_status

retrieves the latest status for a post

enumerate_posts

enumerates all the posts from the database if the blog id belongs to a selection (or all if blog_selection is empty) …

enumerate_posts_status

enumerate status

private_process_condition

Returns a SQL query corresponding to list of posts.

Documentation

description of a RSS stream

source on GitHub

class pyrsslocal.rss.rss_database.DatabaseRSS(dbfile, table_blogs='blogs', table_posts='posts', table_stats='posts_stat', table_event='events', LOG=<function fLOG>)[source]

Bases: pyensae.sql.database_main.Database

database specific to RSS

source on GitHub

constructor

Parameters
  • dbfile – file database

  • table_blogs – table name for the blogs

  • table_posts – table name for the posts

  • table_stats – table name for the posts stats

  • table_event – table name for the events

  • LOG – logging function

source on GitHub

__init__(dbfile, table_blogs='blogs', table_posts='posts', table_stats='posts_stat', table_event='events', LOG=<function fLOG>)[source]

constructor

Parameters
  • dbfile – file database

  • table_blogs – table name for the blogs

  • table_posts – table name for the posts

  • table_stats – table name for the posts stats

  • table_event – table name for the events

  • LOG – logging function

source on GitHub

__str__()[source]

usual

source on GitHub

create_missing_table()[source]

creates the missing tables

source on GitHub

enumerate_blogs(sorted_=True, specific=None, daily_freq=1.5, now=None, addstat=False)[source]

Enumerates all the blogs from the database.

Parameters
  • sorted – sorted by title

  • specific – specific search - None: all blogs - today: get all blogs for today - twoday: get all blogs for today and yesterday - week: get all blogs for last week - notfrequent: get all blogs publishing less posts in a day than daily_freq - frequent: get all blogs publishing more posts in a day than daily_freq

  • daily_freq – see parameter specific

  • now – if None, today means today, if not None, now will have the meaning of today

  • addstat – if True, the function will a field corresponding to the number of posts from this blog

Returns

enumeration of StreamRSS

source on GitHub

enumerate_latest_status(postid, nb=1, connect=True)[source]

retrieves the latest status for a post

Parameters
  • postid – post id

  • nb – number of desired status

  • connect – connect (True) or skip connection (False)

Returns

enumerate on values from table_stats ordered by decreasing time

source on GitHub

enumerate_posts(blog_selection=None, post_selection=None, sorted_=True, first=1000, specific=None, daily_freq=1.5, now=None, addstatus=False, searchterm=None)[source]

enumerates all the posts from the database if the blog id belongs to a selection (or all if blog_selection is empty)

Parameters
  • blog_selection – list of blogs to consider (or empty for all)

  • post_selection – list of posts to consider

  • sorted – sorted by date

  • first – we only consider the first first

  • specific – specific search - None: all posts - today: get all posts for today - week: get all posts for last week

  • daily_freq – see parameter specific

  • now – if None, today means today, if not None, now will have the meaning of today

  • addstatus – if True, fetches the status of a blog

  • searchterm – if not None, filters using a SQL like search (using %)

Returns

enumeration of BlogPost

source on GitHub

enumerate_posts_status(blog_selection=None, post_selection=None, sorted_=True, specific=None, now=None, searchterm=None)[source]

enumerate status

Parameters
  • blog_selection – list of blogs to consider (or empty for all)

  • post_selection – list of posts to consider

  • sorted – sorted by date

  • specific – specific search - None: all posts - today: get all posts for today - week: get all posts for last week

  • now – if None, today means today, if not None, now will have the meaning of today

  • searchterm – if not None, filters using a SQL like search (using %)

Returns

enumerate on values from table_stats ordered by decreasing time

source on GitHub

static getday(dt)[source]

return the same datetime but with no time

Parameters

dt – datetime

Returns

datetime which correspond to the beginning of the day

source on GitHub

static getdayn(dt)[source]

return the same datetime but with no time

Parameters

dt – datetime

Returns

datetime which correspond to the beginning of the day

source on GitHub

private_process_condition(blog_selection=None, post_selection=None, sorted_=True, specific=None, now=None, searchterm=None)[source]

Returns a SQL query corresponding to list of posts.

Parameters
  • blog_selection – list of blogs to consider (or empty for all)

  • post_selection – list of posts to consider

  • sorted – sorted by date

  • specific – specific search - None: all posts - today: get all posts for today - week: get all posts for last week

  • searchterm – if not None, filters using a SQL like search (using %)

  • now – if None, today means today, if not None, now will have the meaning of today

Returns

SQL query

source on GitHub

static schema_table(table)[source]

returns the schema for a specific table

Parameters

table – name (in [“stats”, “event”])

Returns

dictionary

source on GitHub