Sour

File: sour.py

class sour.Sour

Bases: object

autocomplete(q)

Return titles by applying autocomplete to the query text.

Parameters

q (str) – Query text

Returns

autocomplete object

get_channel(channel, page=1)

Return all titles under the given channel

Parameters
  • channel (str) – Name of the channel

  • page (str, optional) – Page index of the results

Returns

list of sour_title objects

list_channels()

Return all channels

Returns

list of channel objects

news(page=1)

Return latest news titles.

Parameters

page (int, optional) – Page index of the results

Returns

list of sour_title objects

orphans(page=1)

Return all orphan titles

Parameters

page (int, optional) – Page index of the results

Returns

list of sour_title objects

query(q, page=1, nice=False)

Return entries from a page.

Parameters
  • q (str) – The query text

  • page (int, optional) – Page index of the results

  • nice (boolean, optional) – Option to sort entries by their favorite counts

Returns

list of sour_entry objects

savepage(content)
search(keywords, author=None, page=1, fromdate=None, todate=None, nice_only=False, sort='Topic')

Return titles that match the query parameters.

Parameters
  • keywords (str) – Search keywords

  • author (str, optional) – Specific author for the titles

  • page (int, optional) – Page number of the results

  • fromdate (str, optional) – E.g. 1970-01-01

  • todate (str, optional) – E.g. 1970-01-01

  • nice_only (boolean, optional) – Show only top rated titles

  • sort (str, optional) – ( Topic | Date | Count )

Returns

list of sour_title objects

throwback(year, page=1)

Return all titles from this day on the given year

Parameters
  • year (int) – Year to search for

  • page (int, optional) – Page index of the results

Returns

list of sour_title objects

top_rated()

Return highly rated titles from yesterday.

Returns

list of sour_title objects

class sour.autocomplete(query, titles, nicks)

Bases: object

autocomplete class that provides titles and nicks from a query.

query

The search query

Type

str

titles

Title results

Type

list

nicks

Nick results

Type

list

class sour.channel(name, title, href)

Bases: object

channel class that provides channel information.

name

Name of the channel

Type

str

title

Title of the channel

Type

str

url

URL of the channel

Type

str

class sour.sour_entry(entry_id, author_id, author, avatar, fav_count, date, content)

Bases: object

sour_entry class that provides entry information.

entry_id

ID of the entry

Type

int

author_id

ID of the author

Type

int

author

Nickname of the author

Type

str

author_avatar

Avatar image of the author

Type

str

fav_count

Favorite count of the entry

Type

int

url

URL of the entry

Type

str

date

Entry date

Type

str

content

Content of the entry

Type

str

class sour.sour_item(title, results)

Bases: object

sour_sitem class that provides contents from a title.

title

Title of the item

Type

str

results

Contents of the item

Type

list

class sour.sour_title(href, title, count)

Bases: object

sour_title class that provides title information.

url

URL of the title

Type

str

title

Title of the item

Type

str

count

Content count

Type

int