pisak.blog package

pisak.blog.description module

pisak.blog.config module

Module for storing and managing all the blog configuration parameters.

pisak.blog.config.decrypt_password(encrypted)[source]

Decrypt the given encrypted password.

Parameters:encrypted – encrypted password.
Returns:decrypted password, string.
pisak.blog.config.encrypt_password(password)[source]

Not very safe solution. Only for people who really are unable to remember their password. Anyone who gets here will be able to decrypt the password so we do not need to be very inventive.

Parameters:password – not encrypted password.
Returns:string with an encrpted password.
pisak.blog.config.get_blog_config()[source]

Get all the blog configurations.

Returns:tuple consisting of blog address, user name and user password.
pisak.blog.config.get_followed_blogs()[source]

Get list of all followed blogs.

Returns:list with all followed blogs

pisak.blog.handlers module

pisak.blog.widgets module

pisak.blog.exceptions module

Blog application specific exceptions.

exception pisak.blog.exceptions.BlogAuthenticationError(*args, **kwargs)[source]

Bases: pisak.exceptions.PisakException

Error raised when an authentication attempt fails.

exception pisak.blog.exceptions.BlogInternetError(*args, **kwargs)[source]

Bases: pisak.exceptions.PisakException

Error raised when any problems with connecting to the Internet occur.

exception pisak.blog.exceptions.BlogMethodError(*args, **kwargs)[source]

Bases: pisak.exceptions.PisakException

Error raised when any unexpected blog-related condition occurs.

pisak.blog.html_parsers module

Set of various HTML parsers.

pisak.blog.html_parsers.apply_linebreaks(text)[source]

Convert python-style linebreaks to a html-style ones.

Parameters:text – text with python-style linebreaks.
Returns:text with html-style linebreaks.
pisak.blog.html_parsers.apply_paragraphs(text)[source]

Apply html-style paragraphs to the text.

Parameters:text – text with python-style or no paragraphs.
Returns:text with html-style paragraphs.
pisak.blog.html_parsers.convert_linebreaks(parser)[source]

Converts all html-style linebreaks to the python-style ones.

Parameters:parser – beautiful soup parser.
pisak.blog.html_parsers.delete_images(content)[source]

Remove all the img tags.

Parameters:content – html text.
Returns:content with img tags removed.
pisak.blog.html_parsers.embed_images(content, image_urls)[source]

Embed img tag with image url into the html content.

Parameters:
  • content – html text.
  • image_urls – url to the image or list of urls.
Returns:

content with img tag embedded.

pisak.blog.html_parsers.extract_text(content)[source]

Get all plain text from a html document.

Parameters:content – html text.
Returns:plain text.
pisak.blog.html_parsers.list_images(content)[source]

Extract and list all images in a html text.

Parameters:content – html text.
Returns:list of image urls.

pisak.blog.wordpress module

pisak.blog.rest_client module

Wordpress JSON REST API client implementation.

class pisak.blog.rest_client.Blog(address)[source]

Bases: object

Client of a blog that makes a JSON API avalaible.

Parameters:address – blog’s site domain (string) or ID (integer).
compose_post_view(post)[source]

Compose and arrange all the post elements into a single html document.

Parameters:post – post instance
Returns:properly constructed post view
get_all_posts()[source]

Get all posts from the blog.

Returns:list of all posts. Each post is a dictionary.
get_comment(ide)[source]

Get single comment.

Parameters:ide – id of the comment to be returned.
Returns:single comment. Comment is a dictionary.
get_comments_for_post(post_ide)[source]

Get all comments for the given post.

Parameters:post_ide – id of the post.
Returns:list of all comments for the given post.

Each comment is a dictionary

get_many_posts(offset, number)[source]

Retrieve many posts.

Parameters:
  • offset – offset from which posts should be taken.
  • number – number of posts to retrieve.
Returns:

list of posts.

get_post(ide)[source]

Get single post from the blog.

Parameters:ide – id of a post to be returned.
Returns:single post. Post is a dictionary.

Module contents

pisak.blog.test(config)[source]

Test provided blog settings or server connection.