+ All Categories
Home > Documents > Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that...

Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that...

Date post: 23-Sep-2020
Category:
Upload: others
View: 0 times
Download: 0 times
Share this document with a friend
53
libturpial Documentation Release 1.7.0 Wil Alvarez Sep 27, 2017
Transcript
Page 1: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

libturpial DocumentationRelease 1.7.0

Wil Alvarez

Sep 27, 2017

Page 2: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims
Page 3: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

Contents

1 Features 3

2 Quickstart 52.1 Quickstart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

3 Reference 113.1 API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113.2 Lib . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233.3 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363.4 Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373.5 Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

4 Further information 39

Python Module Index 41

i

Page 4: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

ii

Page 5: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

libturpial Documentation, Release 1.7.0

libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims to supportall the features for each protocol. At the moment it supports only Twitter and is the backend used for Turpial.

libturpial is currently under heavy development, so probably you will find bugs or undesired behavior. In this casesplease report issues at:

https://github.com/satanas/libturpial/issues

We will be grateful for your contributions.

Contents 1

Page 6: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

libturpial Documentation, Release 1.7.0

2 Contents

Page 7: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

CHAPTER 1

Features

• Twitter API

• Identi.ca API

• HTTP and OAuth authentication

• Proxy

• Services for shorten URL and upload images

• Multiple accounts, multiple columns

• User configuration

• Image preview

• Filters

3

Page 8: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

libturpial Documentation, Release 1.7.0

4 Chapter 1. Features

Page 9: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

CHAPTER 2

Quickstart

Quickstart

Are you eager to start coding? Take a look to this section, it will get you a quick introduction on how to use libturpial.

Before start, you must check that libturpial is installed and up-to-date. Check our Wiki page for installing libturpial

Create an account

First thing you need to use libturpial is an account. To create an account import the account module:

>>> from libturpial.api.models.account import Account

Let’s create a new Twitter account:

>>> account = Account.new('twitter')

This account it’s empty, hence pretty useless, except for one thing: authentication. Before you can make real use of anaccount it must be authenticated. To achieve that, let’s ask for OAuth access:

>>> url = account.request_oauth_access()

This will return an OAuth valid URL that you must visit. In this case, it will redirect you to Twitter, so you canauthorize Turpial as a third party app. Then copy the PIN (for example: ‘1234567’) returned by Twitter and authorizethe account:

>>> account.authorize_oauth_access('1234567')

Now you have a valid libturpial account to play with. Remember that this account is not stored in disk yet. To savecredentials you need to read how to register the account.

5

Page 10: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

libturpial Documentation, Release 1.7.0

Register the account

Let’s assume that you have the same account of the previous section (valid and authenticated). To register the account(and with this, save the credentials on disk) you need a new instance of Core. First, let’s import the Core module:

>>> from libturpial.api.core import Core

And now, let’s instantiate Core:

>>> core = Core()

At this moment, Core will try to load any previous registered account to make it available. This shouldn’t take morethan a few seconds (that time could vary depending on your internet connection). When done, we can register ourfresh-new account created in the previous section. To do so:

>>> my_account_id = core.register_account(account)

That will return the account id if everything went fine.

It’s important that you see the Core as a director, it can handle a lot of things at once but we need to specify exactlywhere to perform what we want to do. That’s the reason why almost all methods on core receive as first argument theaccount_id, it’s like if you must to tell:

Core, on this account do that.

It’s not hard once you get used, it’s like: “sudo make me a sandwich” ;) (CC-BY-NC by XKCD)

Fetch the timeline

Now that we have a registered account we would be able to tinker a little bit with Twitter. Let’s fetch the accounttimeline:

>>> timeline = core.get_column_statuses(my_account_id, 'timeline', count=5)

You can print each retrieved status with:

>>> for status in timeline:... print status...<libturpial.api.models.status.Status instance at 0x1031583f8><libturpial.api.models.status.Status instance at 0x103159050><libturpial.api.models.status.Status instance at 0x1031590e0><libturpial.api.models.status.Status instance at 0x1031731b8><libturpial.api.models.status.Status instance at 0x103173320>

But wait, those are just libturpial.api.models.status.Status object. Let’s print something more useful:

>>> for status in timeline:... print "@%s: %s" % (status.username, status.text)...@lombokdesign: La calidad de un link #infografia #infographic #internet #marketing→˓http://t.co/8UF3m0QiAK@TheHackersNews: Edward #Snowden's Father My Son Is Not A Traitor http://t.co/→˓y6j8uB6832 #nsa@Lavinotintocom: #FutVe Buda Torrealba espera alejarse de las lesiones http://t.co/→˓XX53yCY2zv

6 Chapter 2. Quickstart

Page 11: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

libturpial Documentation, Release 1.7.0

@Lavinotintocom: #Eliminatorias César Farías: “Seguimos teniendo fe” #Vinotinto http:/→˓/t.co/QfiMsxpAg9@razonartificial: SDL 2.0: Release Candidate lista http://t.co/B6jVOLly3Y vía→˓@genbetadev

Interesting, isn’t? We can play with all the available attributes of the status object. Check the status reference for moreinformation.

With the get_column_statuses we can fetch statuses from any available column, you just need to change ‘timeline’ forthe desired column.

Fetch any other column

We already know how to fetch the timeline, but what about if we want to fetch any other column? Or even an user list?Well, let’s check first which are the available options:

>>> all_columns = core.all_columns()

This will return a dict with all the available columns per account, so let’s print the slug of each one:

>>> for key, columns in all_columns.iteritems():... print "For %s account:" % key... for column in columns:... print " %s" % column.slug...For foo-twitter account:

timelinerepliesdirectssentfavorites

Now we can fetch some other statuses, for example our favorites:

>>> favorites = core.get_column_statuses(my_account_id, 'favorites')

Or maybe our directs:

>>> directs = core.get_column_statuses(my_account_id, 'directs')

Working with statuses

Update a status is as simple as:

>>> core.update_status(my_account_id, 'Test from libturpial')

If you want to reply a status made by a friend (identified with the id ‘123456789’) then you will need to do somethinglike this:

>>> core.update_status(my_account_id, '@foouser Hey! I am answering your tweet',→˓'123456789')

You can even broadcast a status throught several accounts passing a list with all the account and the text you want toupdate:

2.1. Quickstart 7

Page 12: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

libturpial Documentation, Release 1.7.0

>>> core.broadcast_status([my_account_id1, my_account_id2], 'This is a broadcast test→˓')

Let’s say that you loved a tweet recently posted by a friend and identified by the id ‘123456789’, it’s easy mark it asfavorite:

>>> core.mark_status_as_favorite(my_account_id, '123456789')

Besides, you want to share that lovely tweet with all your followers? No problem:

>>> core.repeat_status(my_account_id, '123456789')

You realize about that nasty tweet on your favs? Get ride off it:

>>> core.unmark_as_favorite(my_account_id, '123456789')

Posted a tweet with a typo again? Let’s delete that mistake:

>>> core.destroy_status(my_account_id, '123456789')

And there are more methods that you can use to handle your statuses. Just take a look to the core documention.

Managing your friendship

Another interesing features about libturpial is that it lets you handle your friends.

Let’s assume that you love the tweets that @a_lovely_account do every day. Well you can follow that account with:

>>> core.follow(my_account_id, 'a_lovely_account')

Or probably you’re tired of those boring tweets of @boring_friend, just unfollow (it’s therapeutic):

>>> core.unfollow(my_account_id, 'boring_friend')

But look, you and I know that always there are bots that bother you every single minute, let’s block them:

>>> core.block(my_account_id, 'annoying_bot')

And report it as spam:

>>> core.report_as_spam(my_account_id, 'annoying_bot')

That way Twitter can do something about it.

Now, there is this friend that you really love but he takes seriously the unfollow thing and you are just tired of theno-sense tweets he does. No problem, mute is for you:

>>> core.mute('my_psycho_friend')

With mute, libturpial simply hides all the tweets related to this guy without unfollow him. He will never notice thatyou are not reading his post. Neat, isn’t? ;)

But wait, this action is reversible. You can give him voice again:

>>> core.unmute('my_psycho_friend')

A final tip, do you want to know if @your_fav_account follows you? Use this:

8 Chapter 2. Quickstart

Page 13: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

libturpial Documentation, Release 1.7.0

>>> core.verify_friendship(my_account_id, 'your_fav_account')

This return True if they actually follows you or False otherwise.

Services

libturpial include support for short URLs, upload pictures and preview pictures. For the first two you can chose whichto use from a wide of options. To check which services are available for shorten URL:

>>> core.available_short_url_services()['snipr.com', 'short.to', 'twurl.nl', 'buk.me', 'ub0.cc', 'fwd4.me', 'short.ie',→˓'burnurl.com', 'git.io', 'hurl.ws', 'digg.com', 'tr.im', 'budurl.com', 'urlborg.com→˓', 'bit.ly', 'snipurl.com', 'a.gd', 'fon.gs', 'xr.com', 'sandbox.com', 'kl.am',→˓'snurl.com', 'to.ly', 'hex.io', 'migre.me', 'chilp.it', 'cli.gs', 'is.gd', 'sn.im',→˓'ur1.ca', 'tweetburner.com', 'x.bb', 'tinyurl.com', 'goo.gl']

You can verify which one is currently selected:

>>> core.get_shorten_url_service()'migre.me'

And even select a different one:

>>> core.set_shorten_url_service('is.gd')

To short a long URL, do something like this:

>>> core.short_single_url('http://turpial.org.ve/news/')'http://is.gd/Qq7Cdo'

But there is more, you can short all the URLs detected in a bunch of text:

>>> message = "This is the URL of the libturpial documentation source https://github.→˓com/satanas/libturpial/tree/development/docs">>> new_message = core.short_url_in_message(message)>>> print new_messageThis is the URL of the libturpial documentation source http://is.gd/BJn0WO

To upload images the process is kind of similar. You check the available services:

>>> core.available_upload_media_services()['mobypicture', 'yfrog', 'twitpic', 'twitgoo', 'img.ly']

Verify the current one selected:

>>> core.get_upload_media_service()'yfrog'

And select a different one:

>>> core.set_upload_media_service('twitpic')

Now, to upload a picture you only need the absolute path to the file and maybe a message to post within the picture(only if the service allows pictures with messages):

2.1. Quickstart 9

Page 14: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

libturpial Documentation, Release 1.7.0

>>> core.upload_media(my_account_id, '/path/to/my/image.png', 'This is my pretty→˓picture')'http://twitpic.com/cytmf2'

Almost all services support JPEG, PNG and GIF format.

libturpial also handle the previsulization process of tweeted images for you. Imagine that your best friend posted apicture and you want to see it, just fetch the image with:

>>> preview = core.preview_media('http://twitpic.com/cytmf2')

libturpial will fetch the image and will store it on a temporary file, returning a libturpial.api.models.media.Media object. You can get the path of the temporary image with:

>>> preview.path'/var/folders/1b/sq85x9v95nl44d2ccdb0_kmc0000gp/T/twitpic.com_cytmf2.jpg'

And even check if it’s really an image (libturpial will support image, video and maps on the near future):

>>> preview.is_image()True

Further information

Previous sections were a brief introduction to the whole power of libturpial. For more information please check thefull documentation

10 Chapter 2. Quickstart

Page 15: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

CHAPTER 3

Reference

This part of the documentation shows you details about specific functions, methods and classes in libturpial.

API

The API module contains the modules and classes that will be used for any developer that want to create an applicationor script based on libturpial. We can call it the public interface. Here you can find the Core, all the models that representlibturpial entities and the Managers

Core

class libturpial.api.core.Core(load_accounts=True)This is the main object in libturpial. This should be the only class you need to instantiate to use libturpial. Mostimportant arguments used in Core are account_id and column_id.

•account_id: Is a composite string formed by the username and the protocol_id that identify every singleaccount.

•column_id: Is composite string formed by account_id and the column_name that identify one column ofone account.

Examples of account_id:

>>> my_twitter_account = 'foo-twitter'>>> my_identica_account = 'foo-identica'

Example of column_id:

>>> twitter_timeline = 'foo-twitter-timeline'>>> identica_replies = 'foo-identica-replies'

When you instantiate Core it will load all registered accounts automatically, so you don’t need to worry aboutit. If you already registered the accounts before, they will be available after you create the core object.

11

Page 16: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

libturpial Documentation, Release 1.7.0

All the Core methods will return an object defined in libturpial.api.models or a valid python object ifrequest is successful, otherwise they will raise an exception.

If the request returns an array, you can iterate over the elements with:

>>> core = Core()>>> followers = core.get_followers('username-protocol')>>> [follower for follower in followers]

In all the following functions the following apply: account_id must be a string (“username-service”) col-umn_id must be a string (“columnname-username-service”)

fetch_image(url)Retrieve an image by it URL. Return the binary data of the image

list_accounts()Return an array with the ids of all registered accounts. For example:

>>> ['foo-twitter', 'foo-identica']

register_account(account)Register account into config files. account must be a valid and authenticated libturpial.api.models.account.Account object.

When instantiating Core() all accounts get automatically registered.

Return a string with the id of the account registered.

unregister_account(account_id, delete_all=False)Removes the account identified by account_id from memory. If delete_all is True it deletes all the filesasociated to that account from disk otherwise the account will be available the next time you load Core.

Return a string with the id of the account unregistered.

all_columns()Return a dictionary with all columns per account. Example:

>>> {'foo-twitter': [libturpial.api.models.Column foo-twitter-timeline,libturpial.api.models.Column foo-twitter-replies,libturpial.api.models.Column foo-twitter-direct,libturpial.api.models.Column foo-twitter-sent,libturpial.api.models.Column foo-twitter-favorites]}

register_column(column_id)Register a column identified by column_id column and return a string with the id of the column registeredon success.

unregister_column(column_id)Removes the column identified by column_id from config and return a string with the id if the columnunregistered on success.

list_protocols()Return an array with the ids of supported protocols. For example:

>>> ['twitter', 'identica']

available_columns()Return a dictionary with all available (non-registered-yet) columns per account. Example:

12 Chapter 3. Reference

Page 17: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

libturpial Documentation, Release 1.7.0

>>> {'foo-twitter': [libturpial.api.models.Column foo-twitter-direct,libturpial.api.models.Column foo-twitter-replies,libturpial.api.models.Column foo-twitter-sent]}

registered_columns()Return a dict with libturpial.api.models.column.Column objects per column registered.This method DO NOT return columns in the order they have been registered. For ordered columns checkregistered_columns_by_order()

registered_columns_by_order()Return a list with libturpial.api.models.column.Column objects per each column in the sameorder they have been registered.

registered_accounts()Return a dict with all registered accounts as an array of libturpial.api.models.account.Account objects registered

get_single_column(column_id)Return the libturpial.api.models.column.Column object identified with column_id

get_single_account(account_id)Return the libturpial.api.models.account.Account object identified with account_id

get_column_statuses(account_id, column_id, count=20, since_id=None)Fetch the statuses for the account account_id and the column column_id. count let you specify how manystatuses do you want to fetch, values range goes from 0-200. If since_id is not None libturpial will onlyfetch statuses newer than that.

get_public_timeline(account_id, count=20, since_id=None)Fetch the public timeline for the service associated to the account account_id. count and since_id work inthe same way that in libturpial.api.core.Core.get_column_statuses()

get_followers(account_id, only_id=False)Returns a libturpial.api.models.profile.Profile list with all the followers of the accountaccount_id

get_following(account_id, only_id=False)Returns a libturpial.api.models.profile.Profile list of all the accounts that account_idfollows

get_all_friends_list()Return a list with all the username friends of all the registered accounts.

get_user_profile(account_id, user=None)Return the profile of the user, using the account_id, if user is None, it returns the profile of account_iditself.

update_status(account_id, text, in_reply_id=None, media=None)Updates the account account_id with content of text

if in_reply_id is not None, specifies the tweets that is being answered.

media can specify the filepath of an image. If not None, the status is posted with the image attached. Atthis moment, this method is only valid for Twitter.

broadcast_status(account_id_array, text)Updates all the accounts in account_id_array with the content of text

if account_id_array is None or an empty list all registered accounts get updated.

destroy_status(account_id, status_id)Deletes status of account_id specified by status_id

3.1. API 13

Page 18: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

libturpial Documentation, Release 1.7.0

get_single_status(account_id, status_id)Retrieves a single status with account_id that corresponds with status_id

repeat_status(account_id, status_id)Allows to send the same status again by using repeat option in API

mark_status_as_favorite(account_id, status_id)Marks status of account_id specified by status_id as favorite

unmark_status_as_favorite(account_id, status_id)Unmarks status of account_id specified by status_id as favorite

send_direct_message(account_id, username, message)Sends a direct update with the contant of message to username using account_id

destroy_direct_message(account_id, status_id)Deletes a direct update from account_id defined by its status_id

update_profile(account_id, fullname=None, url=None, bio=None, location=None)Updates the account_id public profile with the information in variables fullname = Complete account nameurl = Blog or personal URL of the account bio = Small resume location = Geographic location

follow(account_id, username, by_id=False)Makes account_id a follower of username. Return a libturpial.api.models.profile.Profile object with the user profile

unfollow(account_id, username)Stops account_id from being a follower of username. Return a libturpial.api.models.profile.Profile object with the user profile

block(account_id, username)Blocks username in account_id. Return a libturpial.api.models.profile.Profile objectwith the user profile

unblock(account_id, username)Unblocks username in account_id. Return a libturpial.api.models.profile.Profile ob-ject with the user profile

report_as_spam(account_id, username)Reports username as SPAM using account_id. Return a libturpial.api.models.profile.Profile object with the user profile

mute(username)Adds username into the muted list, so that no more statuses from that account are shown

unmute(username)Removes username from the muted list, so that statuses from that account are now shown

verify_friendship(account_id, username)Check if username is on only followed by account_id but if he also follows account_id

search(account_id, query, count=20, since_id=None, extra=None)Performs a search using Twitter API, defined by: account_id = Account to be used for the search query =Search Term acount = Max number of results since_id = if limited to a status id and on.

get_profile_image(account_id, username, use_cache=True)Returns the local path to a the profile image of username in original size. If use_cache is True it will try toreturn the cached file, otherwise it will fetch the real image.

get_status_avatar(status)Returns the local path to a the profile image of the username to post status in 48x48 px size

14 Chapter 3. Reference

Page 19: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

libturpial Documentation, Release 1.7.0

get_available_trend_locations(account_id)Return an array of libturpial.api.models.trend.TrendLocation objects with all the loca-tions with trending topics registered.

get_trending_topics(account_id, location_id)Return an array of libturpial.api.models.trend.Trend objects with trending topics for thespecified location. location_id is the Yahoo! Where On Earth ID for the location.

update_profile_image(account_id, image_path)Update profile image of account_id with the image specified by image_path. Return a libturpial.api.models.profile.Profile object with the user profile updated.

register_new_config_option(section, option, default_value)Register a new configuration option in section to be handled by external modules. libturpial will setdefault_value as value if the option doesn’t exist.

This method should be used if a module that uses libturpial needs to handle configuration options notregistered by default.

For example, if you want to register an option to handle notifications on login the code should looks like:

>>> core = Core()>>> core.register_new_config_option('Notifications', 'login', 'on')

From this point you can use config methods over this value as usual.

is_muted(username)Return True is username is muted. False otherwise

get_max_statuses_per_column()Return how many statuses should be fetched in each requests

get_proxy()Return a libturpial.api.models.proxy.Proxy object with the configuration stored in disk.

get_socket_timeout()Return the timeout set for the socket connections

list_filters()Return a list with all registered filters

save_filters(lst)Save lst a the new filters list

delete_current_config()Delete current configuration file. This action can not be undone

delete_cache()Delete all files in cache

get_cache_size()Return current space used by cache

add_friend(username)Save username into the friends list

remove_friend(username)Remove username from friends list

3.1. API 15

Page 20: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

libturpial Documentation, Release 1.7.0

Models

Here you can find the representation of the information used by libturpial mapped to Python objects. They handle themethods and properties of each entity and guarantee the data consistency.

Account

class libturpial.api.models.account.Account(protocol_id, username=None)This class represents an user account and holds all it related methods. This is done thanks to one libturpial.lib.interfaces.protocol.Protocol instance associated to the user account that handles all the dirtywork against the service (Twitter, Identi.ca, etc) as well as one libturpial.api.models.profile.Profile model that store the user details.

This is the class you must instantiate if you want to handle/authenticate a user account.

Account let you perform three actions to build an account: create a new account from scratch, create a newaccount from parameters and load a previously registered account. To create a new account from scratch do:

>>> account = Account.new('twitter')

If you know the user name too, then you can pass it as argument:

>>> account = Account.new('twitter', 'username')

At this point, that account is not a valid account yet because it hasn’t been authenticated. You should do theauthentication by yourself. This is, request OAuth access:

>>> url = account.request_oauth_access()

That method will return an URL that your user must visit to authorize the application. After that, you must toask for the PIN returned by the service and execute:

>>> account.authorize_oauth_access('the_pin')

And voilá! You now have a valid and fully authenticated account ready to be registered in libturpial.api.core.Core.

But Account let you create accounts passing all the parameters needed for the OAuth authentication. If youalready know those parameters (user key, user secret and PIN) then you just need to execute:

>>> account = Account.new('twitter', 'username', 'key',→˓ 'secret', 'the_pin')

And you will have a valid and fully authenticated account ready to be registered in libturpial.api.core.Core too.

Now, what if you did all this process before and registered the account in libturpial.api.core.Core?Well, you just need to load the account then:

>>> account = Account.load('username-twitter')

And you will have an account already authenticated and ready to be used.

From this point you can use the method described here to handle the account object.

static new(protocol_id, username=None, key=None, secret=None)Return a new account object associated to the protocol identified by protocol_id. If username is not Noneit will build the account_id for the account.

16 Chapter 3. Reference

Page 21: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

libturpial Documentation, Release 1.7.0

If you don’t enter the key and secret parameters this account is empty and must be authenticated beforeit can be registered in libturpial.api.core.Core. Otherwise, this account is authenticated aftertheir creation, so it can be registered in libturpial.api.core.Core immediately.

Warning: None information is stored at disk at this point.

static new_from_params(protocol_id, username, key, secret, verifier)Deprecated since version 2.0.

Use new() instead.

static load(account_id)Return the account object associated to account_id loaded from existing configuration. If theaccount_id does not correspond to a valid account it returns a libturpial.exceptions.ErrorLoadingAccount exception.

If credentials in configuration file are empty it returns a libturpial.exceptions.EmptyOAuthCredentials exception.

request_oauth_access()Ask for an OAuth token. Return an URL that must be visited for the user in order to authenticate the app.

authorize_oauth_access(pin)Take the pin returned by OAuth service and authenticate the token requested with request_oauth_access

save()Save to disk the configuration and credentials for the account. If the account hasn’t been authenticated itwill raise an libturpial.exceptions.AccountNotAuthenticated exception.

fetch()Retrieve the user profile information and return the id of the account on success. This method authenticatethe account.

fetch_friends()Retrieve all the friends for the user and return an array of string where each element correspond to theuser_id of the friend.

get_columns()Return an array of libturpial.api.models.column.Column with all the available columns forthe user

purge_config()Delete all config files related to this account

delete_cache()Delete all files cached for this account

get_cache_size()Return disk space used by cache in bytes

is_authenticated()Return True if the current account has been logged in, False otherwise

update_profile(fullname=None, url=None, bio=None, location=None)Update the fullname, url, bio or location of the user profile. You may specify one or more arguments.Return an libturpial.api.models.profile.Profile object containing the user profile

3.1. API 17

Page 22: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

libturpial Documentation, Release 1.7.0

Column

class libturpial.api.models.column.Column(account_id, slug, singular_unit=’tweet’, plu-ral_unit=’tweets’)

This model represents a column that holds libturpial.api.models.status.Status objects. Youneed to specify to what account_id are they associated, as well as the column slug. Available column slugs areavailable in libturpial.common.ColumnType.

Variables

• id – Column id (for example: “johndoe-twitter-timeline”)

• slug – Column slug

• account_id – id of account associated to the column

• size – max number of statuses that this column can hold

• singular_unit – unit used to identify one status (e.g: ‘tweet’)

• plural_unit – unit used to identify more than one status (e.g: ‘tweets’)

List

class libturpial.api.models.list.ListThis class handles the information about a user list. It receives the id_, the user who owns it, the name (alsoknown as slug), the title or caption, the number of suscribers, it description and the units used for plural andsingular: singular_unit, plural_unit.

Variables

• id – List id

• user – User that owns the list

• slug – List name

• title – List title

• suscribers – Suscribed users (count)

• description – List description

• single_unit – Singularized unit (‘tweet’ for example)

• plural_unit – Pluralized unit (‘tweet’ for example)

Status

class libturpial.api.models.status.StatusThis model represents and holds all the information of a status.

Variables

• id – Status id

• account_id – Id of the account associated to this status

• text – Text of the status

• username – Name of the user that updated the status

• avatar – Display image of the user that updated the status

18 Chapter 3. Reference

Page 23: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

libturpial Documentation, Release 1.7.0

• source – Client used to upload this status

• timestamp – Time of publishing of this status (Unix time)

• in_reply_to_id – Contains the id of the status answered (if any)

• in_reply_to_user – Contains the user answered with status (if any)

• is_favorite – True if this status has been marked as favorite. False otherwise

• is_protected – True if this status is from a protected account. False otherwise

• is_verified – True if this status is from a verified account. False otherwise

• repeated – True if this status has been repeated (retweeted) by you. False otherwise

• repeated_by – More users that have repeated this status

• repeated_count – How much times this status has been repeated

• original_status_id – Id of the original status (not-repeated)

• created_at – Original timestamp from the service

• datetime – Humanized representation of the date/time of this status

• is_own – True if the status belongs to the same user of the associated account. Falseotherwise

• entities – A dict with all the entities found in status

• type – Status type.

Sometimes a status can hold one or more entities (URLs, hashtags, etc). In this case the entities variable willstore a dict with lists for each category. For example:

>>> status = Status()>>> status.entities{'urls': [], 'hashtags': [], 'mentions': [], 'groups': []}

A status can handle two possible types: libturpial.api.models.status.Status.NORMAL for reg-ular statuses or libturpial.api.models.status.Status.DIRECT for private (direct) statuses.

get_mentions()Returns all usernames mentioned in status (even the author of the status)

is_direct()Return True if this status is a direct message

get_protocol_id()Return the protocol_id associated to this status

get_source(source)Parse the source text in the status and store it in a libturpial.api.models.client.Clientobject.

Profile

class libturpial.api.models.profile.ProfileThis model handles all the information stored for a user profile.

Variables

• id – Profile id

3.1. API 19

Page 24: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

libturpial Documentation, Release 1.7.0

• account_id – Account id that fetched this profile

• fullname – Full name of the user

• avatar – Display image

• location – User location

• url – User URL

• bio – User bio or description

• following – Indicate if the user is following to the account_id owner (True‘or ‘False)

• followed_by – Indicate if the user is followed by the account_id owner (True‘or ‘False)

• follow_request – Indicate if there is a pending follow request of this profile

• followers_count – Number of followers of this user

• friends_count – Number of friends of this user

• favorites_count – Number of favorite statuses of this user

• statuses_count – Number of statuses this user has done

• link_color – Color used to highlight entities (URLs, hashtags, etc)

• last_update – Text of the last status updated

• last_update_id – Id of the last status updated

• protected – Indicate if the profile is protected (True‘or ‘False)

• verified – Indicate if the profile is verified (True‘or ‘False)

is_me()Return True if the username of the profile is the same of the associated account, otherwise False. Thismethod can be useful to determinate if a status belongs to given account.

get_protocol_id()Returns the protocol_id for this profile

Entity

class libturpial.api.models.entity.Entity(account_id, url, text, search)Sometimes a libturpial.api.models.status.Status can content mentions, URLs, hashtags andother class of interactuable objects, so this class models that data in a structured way

Variables

• account_id – Id of the account that holds the status

• url – A possible URL for the media/content

• display_text – Text that must be displayed to user

• search_for – Text that must be used to search this object

Client

class libturpial.api.models.client.Client(name=None, url=None)This class models the information of the client of a given status

Variables

20 Chapter 3. Reference

Page 25: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

libturpial Documentation, Release 1.7.0

• name – Client name

• url – Client URL

Media

class libturpial.api.models.media.Media(type_, name, content, path=None, info=None)This class represents a media object (image, video or map) that can be rendered on the UI. type_could be libturpial.api.models.media.IMAGE, libturpial.api.models.media.VIDEOor libturpial.api.models.media.MAP, name is the filename and content holds the binary data ofthe media. If path is None a temporary path will be created using the filename. info stores any additionalinformation about the resource.

static new_image(name, content, path=None, info=None)Create an image media

save_content()Saves the content of the media in the path specified.

is_video()Returns True if the media is a video

is_image()Returns True if the media is an image

is_map()Returns True if the media is a map

Proxy

class libturpial.api.models.proxy.Proxy(host, port, username=None, password=None, se-cure=False)

This class models the information of a proxy server used to establish an HTTP connection. host and port arerequired. For an authenticated proxy set username and password with according credentilas and if proxy usesHTTPS set secure to True, otherwise let it empty or False

For example, to store the information of a non-authenticated HTTPS proxy:

>>> proxy = Proxy('127.0.0.1', '1234', secure=True)

And for an authenticated HTTP proxy:

>>> proxy = Proxy('127.0.0.1', '1234', 'my_user', 'secret_password')

Variables

• host – Proxy host address

• port – Proxy port

• username – (Optional) Username for authentication

• password – (Optional) Password for authentication

• secure – Indicate whether proxy uses HTTP or HTTPS (Default False)

3.1. API 21

Page 26: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

libturpial Documentation, Release 1.7.0

Managers

This classes are used by libturpial.api.core.Core to handle and organize multiple instances of columns andaccounts. They are responsible of add, delete and manage both.

Account Manager

class libturpial.api.managers.accountmanager.AccountManager(config, load=True)This class has methods to manage accounts. You can register new accounts, load and unregister existing ac-counts.

This manager can be iterated and each element will have the account id and the respective object. For example:

>>> from libturpial.config import AppConfig>>> config = AppConfig()>>> account_manager = AccountManager(config)>>> [item for item in account_manager]

To check how much accounts are registered simply use the len function:

>>> len(accman)2

load(account_id)Load and existing account identified by account_id. If the load fails an libturpial.exceptions.ErrorLoadingAccount exception will raise. Return the id of the account loaded on success

register(account)Register the account object passed as argument. If the account hasn’t been authenticated it will raisea libturpial.exceptions.AccountNotAuthenticated exception. If the account is alreadyregistered a libturpial.exceptions.AccountAlreadyRegistered exception will raise. Re-turn the id of the account registered on success

unregister(account_id, delete_all)Remove the account identified by account_id from memory. If delete_all is True all configuration files aredeleted from disk. Be careful because this operation can not be undone. Return the id of the unregisteredcolumn on success, None otherwise

get(account_id)Obtain the account identified by account_id. If the account is not loaded yet, it will be loaded immediately.Return a libturpial.api.models.account.Account object on success

list()Return an alphabetically sorted list with all the ids of the registered accounts.

accounts()Return a list of libturpial.api.models.account.Account objects with all the accounts reg-istered

Column Manager

class libturpial.api.managers.columnmanager.ColumnManager(config)This class has methods to manage columns. You can register new columns, load and unregister existing columns.

This manager can be iterated and each element will have a list of columns per account. For example:

22 Chapter 3. Reference

Page 27: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

libturpial Documentation, Release 1.7.0

>>> column_manager = ColumnManager(config)>>> for item in column_manager:

print item('foo-twitter', [<libturpial.api.models.column.Column instance at 0x10a9ce368>,

<libturpial.api.models.column.Column instance at 0x10a9ce8c0>])

register(column_id)Register a new column identified by column_id. If the column is already registered a libturpial.exceptions.ColumnAlreadyRegistered exception will raise. Return the id of the column reg-istered on success

unregister(column_id)Remove the column identified by column_id from memory. Return the id of the unregistered column.

get(column_id)Obtain the column identified by column_id and return a libturpial.api.models.column.Column object on success. None otherwise.

columns()Return a dict where each key represents an account_id and it value is a list of libturpial.api.models.column.Column objects with all the columns registered.

For example:

>>> from libturpial.config import AppConfig>>> config = AppConfig()>>> column_manager = ColumnManager(config)>>> column_manager.columns(){'foo-twitter': [<libturpial.api.models.column.Column instance at 0x10a9cbb48>→˓,

<libturpial.api.models.column.Column instance at 0x10a9cb6c8>]}

is_registered(column_id)Return True if column identified by column_id is registered. False otherwise.

Lib

Interfaces

Protocol.py

class libturpial.lib.interfaces.protocol.ProtocolBridge class to define abstract functions that must have any protocol implementation

IDENTICA = ‘identica’

TWITTER = ‘twitter’

__init__()

__module__ = ‘libturpial.lib.interfaces.protocol’

available_trend_locations()Search for trend locations

3.2. Lib 23

Page 28: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

libturpial Documentation, Release 1.7.0

Warning: This is an empty method and must be reimplemented on child class, otherwise it will raisea NotImplementedError exception

static availables()

block(user)Blocks the specified user

Warning: This is an empty method and must be reimplemented on child class, otherwise it will raisea NotImplementedError exception

convert_time(str_datetime)Takes the str_datetime and convert it into Unix time

destroy_direct_message(direct_message_id)Destroy a direct message

Warning: This is an empty method and must be reimplemented on child class, otherwise it will raisea NotImplementedError exception

destroy_status(status_id)Destroy a posted update

Warning: This is an empty method and must be reimplemented on child class, otherwise it will raisea NotImplementedError exception

follow(user, by_id)Follow somebody

Warning: This is an empty method and must be reimplemented on child class, otherwise it will raisea NotImplementedError exception

get_blocked()Fetch the list of blocked users

Warning: This is an empty method and must be reimplemented on child class, otherwise it will raisea NotImplementedError exception

get_conversation(status_id)Fetch a whole conversation starting from status_id

Warning: This is an empty method and must be reimplemented on child class, otherwise it will raisea NotImplementedError exception

24 Chapter 3. Reference

Page 29: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

libturpial Documentation, Release 1.7.0

get_directs(count, since_id)Fetch count direct messages received starting from since_id. If since_id is None it will fetch the last countstatuses

Warning: This is an empty method and must be reimplemented on child class, otherwise it will raisea NotImplementedError exception

get_directs_sent(count, since_id)Fetch count direct messages sent starting from since_id. If since_id is None it will fetch the last countstatuses

Warning: This is an empty method and must be reimplemented on child class, otherwise it will raisea NotImplementedError exception

get_entities(status)

get_favorites(count)Fetch count favorite statuses starting from since_id. If since_id is None it will fetch the last count statuses

Warning: This is an empty method and must be reimplemented on child class, otherwise it will raisea NotImplementedError exception

get_followers(only_id=False)Fetch an array of :class list of followers

Warning: This is an empty method and must be reimplemented on child class, otherwise it will raisea NotImplementedError exception

get_following(only_id=False)Fetch the list of following

Warning: This is an empty method and must be reimplemented on child class, otherwise it will raisea NotImplementedError exception

get_int_time(strdate)Converts the strdate into a Unix time long integer (GMT 0)

get_list_statuses(list_id, since_id)Fetch all statuses from list_id starting from since_id. If since_id is None it will fetch the last availablestatuses

Warning: This is an empty method and must be reimplemented on child class, otherwise it will raisea NotImplementedError exception

get_lists(username)Fetch all the lists where username is part of

3.2. Lib 25

Page 30: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

libturpial Documentation, Release 1.7.0

Warning: This is an empty method and must be reimplemented on child class, otherwise it will raisea NotImplementedError exception

get_profile(user)Fetch an especific user profile

Warning: This is an empty method and must be reimplemented on child class, otherwise it will raisea NotImplementedError exception

get_profile_image(user)Returns the URL for the profile image of the given user

Warning: This is an empty method and must be reimplemented on child class, otherwise it will raisea NotImplementedError exception

get_public_timeline(count, since_id)Fetch count statuses from public timeline starting from since_id. If since_id is None it will fetch the lastcount statuses

Warning: This is an empty method and must be reimplemented on child class, otherwise it will raisea NotImplementedError exception

get_rate_limits()Fetch the rate limits for the service

Warning: This is an empty method and must be reimplemented on child class, otherwise it will raisea NotImplementedError exception

get_repeaters(status_id, only_username=False)Fetch all the users that repeated status_id

Warning: This is an empty method and must be reimplemented on child class, otherwise it will raisea NotImplementedError exception

get_replies(count, since_id)Fetch count mentions starting from since_id. If since_id is None it will fetch the last count statuses

Warning: This is an empty method and must be reimplemented on child class, otherwise it will raisea NotImplementedError exception

get_sent(count, since_id)Fetch count sent statuses starting from since_id. If since_id is None it will fetch the last count statuses

26 Chapter 3. Reference

Page 31: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

libturpial Documentation, Release 1.7.0

Warning: This is an empty method and must be reimplemented on child class, otherwise it will raisea NotImplementedError exception

get_status(status_id)Fetch the status identified by status_id

Warning: This is an empty method and must be reimplemented on child class, otherwise it will raisea NotImplementedError exception

get_str_time(strdate)Converts the strdate into a formatted string (GMT 0)

get_timeline(count, since_id)Fetch count statuses from timeline starting from since_id. If since_id is None it will fetch the last countstatuses

Warning: This is an empty method and must be reimplemented on child class, otherwise it will raisea NotImplementedError exception

initialize_http()Creates a new TurpialHTTP instance that must be stored in self.http

For OAuth do:

>>> from libturpial.lib.http import TurpialHTTPOAuth>>> base_url = 'http://api.twitter.com/1.1'>>> oauth_options = { 'consumer_key': 'APP_CONSUMER_KEY'}>>> http = TurpialHTTPOAuth(base_url, oauth_options)

For Basic Auth do:

>>> from libturpial.lib.http import TurpialHTTPBasicAuth>>> http = TurpialHTTPBasicAuth(base_url)

is_friend(user)Returns True is user follows current account, False otherwise

Warning: This is an empty method and must be reimplemented on child class, otherwise it will raisea NotImplementedError exception

json_to_list(response)Takes a JSON response and returns a libturpial.api.models.list.List object

Warning: This is an empty method and must be reimplemented on child class, otherwise it will raisea NotImplementedError exception

json_to_profile(response)Takes a JSON response and returns a libturpial.api.models.profile.Profile object

3.2. Lib 27

Page 32: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

libturpial Documentation, Release 1.7.0

Warning: This is an empty method and must be reimplemented on child class, otherwise it will raisea NotImplementedError exception

json_to_ratelimit(response)Takes a JSON response and returns a libturpial.api.models.ratelimit.RateLimit object

Warning: This is an empty method and must be reimplemented on child class, otherwise it will raisea NotImplementedError exception

json_to_status(response)Takes a JSON response and returns a libturpial.api.models.status.Status object

Warning: This is an empty method and must be reimplemented on child class, otherwise it will raisea NotImplementedError exception

mark_as_favorite(status_id)Mark an update as favorite

Warning: This is an empty method and must be reimplemented on child class, otherwise it will raisea NotImplementedError exception

repeat_status(status_id)Repeat to all your friends an update posted by somebody

Warning: This is an empty method and must be reimplemented on child class, otherwise it will raisea NotImplementedError exception

report_as_spam(user)Blocks and report the specified user as spammer

Warning: This is an empty method and must be reimplemented on child class, otherwise it will raisea NotImplementedError exception

request_access()Return an OAuth authorization URL. Do not overide if the protocol does not support OAuth

search(query, count, since_id=None, extra=None)Execute a search query in server

Warning: This is an empty method and must be reimplemented on child class, otherwise it will raisea NotImplementedError exception

send_direct_message(user, text)Send a direct message

28 Chapter 3. Reference

Page 33: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

libturpial Documentation, Release 1.7.0

Warning: This is an empty method and must be reimplemented on child class, otherwise it will raisea NotImplementedError exception

setup_user_credentials()Set the information related to user credentials. key, secret and verifier for the OAuth case and username,password in the Basic case

trends(location_id)Search for trending topics in location_id

Warning: This is an empty method and must be reimplemented on child class, otherwise it will raisea NotImplementedError exception

unblock(user)Unblocks the specified user

Warning: This is an empty method and must be reimplemented on child class, otherwise it will raisea NotImplementedError exception

unfollow(user)Unfollow somebody

Warning: This is an empty method and must be reimplemented on child class, otherwise it will raisea NotImplementedError exception

unmark_as_favorite(status_id)Unmark an update as favorite

Warning: This is an empty method and must be reimplemented on child class, otherwise it will raisea NotImplementedError exception

update_profile(fullname=None, url=None, bio=None, location=None)Update the user profile

Warning: This is an empty method and must be reimplemented on child class, otherwise it will raisea NotImplementedError exception

update_profile_image(image_path)Update user profile image and return user profile object

Warning: This is an empty method and must be reimplemented on child class, otherwise it will raisea NotImplementedError exception

update_status(text, in_reply_to_id=None, media=None)Post an update

3.2. Lib 29

Page 34: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

libturpial Documentation, Release 1.7.0

Warning: This is an empty method and must be reimplemented on child class, otherwise it will raisea NotImplementedError exception

verify_credentials()

verify_credentials_provider()

Service.py

class libturpial.lib.interfaces.service.GenericService

__init__()

__module__ = ‘libturpial.lib.interfaces.service’

_get_request(url, data=None)Process a GET request and returns a text plain response

_json_request(url)Process a GET request and returns a json hash

_parse_xml(key, xml)Simple XML parser

_quote_url(url)

do_service(arg)

Http

Generic module to handle HTTP requests in libturpial

TurpialHTTPBase

class libturpial.lib.http.TurpialHTTPBase(base_url, proxies=None, timeout=None)This class is the abstraction of the HTTP protocol for libturpial. It handles all the magic behind http requests:building, authenticating and fetching resources, in other words, it standarize the way you interact with end pointsand services.

You shouldn’t instantiate this class, instead you should use the proper implementation for OAuth(libturpial.api.interfaces.http.TurpialHTTPOAuth) or Basic Auth (libturpial.api.interfaces.http.TurpialHTTPBasicAuth) or even develop your own implementation if the authen-tication method is not supported.

base_url is the part of the URL common for all your requests (api.twitter.com/1.1 for example). proxies is a dictwhere you define HTTP/HTTPS proxies.

>>> proxies = {... "http": "http://10.10.1.10:3128",... "https": "https://10.10.1.10:1080",... }

If your proxy uses HTTP authentication then you can set user and password with something like this:

30 Chapter 3. Reference

Page 35: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

libturpial Documentation, Release 1.7.0

>>> proxies = {... "http": "http://user:[email protected]:3128",... }

timeout is the maximum time in seconds that TurpialHTTPBase will wait before cancelling the current request.If timeout is not specified then DEFAULT_TIMEOUT will be used.

__init__(base_url, proxies=None, timeout=None)

__module__ = ‘libturpial.lib.http’

get(uri, args=None, _format=’json’, base_url=None, secure=False, id_in_url=True)Performs a GET request against the uri resource with args. You can specify the _format (‘json’ or ‘xml’)and can specify a different base_url. If secure is True the request will be perform as HTTPS, otherwise itwill be performed as HTTP.

This method is an alias for request function using ‘GET’ as method.

post(uri, args=None, _format=’json’, base_url=None, secure=False, id_in_url=False, files=None)Performs a POST request against the uri resource with args. You can specify the _format (‘json’ or ‘xml’)and can specify a different base_url. If secure is True the request will be perform as HTTPS, otherwise itwill be performed as HTTP.

This method is an alias for request function using ‘POST’ as method

request(method, uri, args=None, _format=’json’, alt_base_url=None, secure=False,id_in_url=False, files=None)

Performs a GET or POST request against the uri resource with args. You can specify the _format (‘json’or ‘xml’) and can specify a different base_url. If secure is True the request will be perform as HTTPS,otherwise it will be performed as HTTP

set_proxy(host, port, username=’‘, password=’‘, https=False)Set an HTTP/HTTPS proxy for all requests. You must pass the host and port. If your proxy uses HTTPauthentication you can pass the username and password too. If https is True your proxy will use HTTPS,otherwise HTTP.

set_timeout(timeout)Configure the maximum time (in seconds) to wait before killing the current request.

sign_request(httpreq)This is the method you need to overwrite if you subclass libturpial.api.interfaces.http.TurpialHTTPBase.

httpreq is the current request (a libturpial.api.interfaces.http.TurpialHTTPRequestobject), you need to apply all the authentication/authorization methods to that object and make it valid;then exit. There is no need to return any value because all changes are done directly over the object.

If this method is not overwritten it will return a NotImplementedError exception.

TurpialHTTPOAuth

class libturpial.lib.http.TurpialHTTPOAuth(base_url, oauth_options, user_key=None,user_secret=None, verifier=None, proxies=None,timeout=None)

Implementation of TurpialHTTPBase for OAuth. base_url is the part of the URL common for all your requests(api.twitter.com/1.1 for example). oauth_options is a dict with all the OAuth configuration parameters. It mustlooks like:

3.2. Lib 31

Page 36: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

libturpial Documentation, Release 1.7.0

>>> oauth_options = {... 'consumer_key': 'APP_CONSUMER_KEY',... 'consumer_secret': 'APP_CONSUMER_SECRET',... 'request_token_url': 'http://request_url',... 'authorize_token_url': 'http://authorize_url',... 'access_token_url': 'http://access_url',... }

consumer_key and consumer_secret are the credentials for your application (they must be provided by the OAuthservice). request_token_url, authorize_token_url and access_token_url are the URLs designed by the OAuthservice to fetch and authorize an OAuth token.

user_key, user_secret and verifier (a.k.a. PIN) are the token credentials granted to the user after the OAuthdance. They are optional and needed only if the user was already authenticated, otherwise you need to fetch anew token.

proxies and timeout work in the same way that in libturpial.api.interfaces.http.TurpialHTTPBase.

•To request an OAuth token create a new TurpialHTTPOAuth object and request a token to your service:

>>> base_url = 'http://api.twitter.com/1.1'>>> http = TurpialHTTPOAuth(base_url, oauth_options)>>> url_to_auth = http.request_token()

Ask the user go to the url_to_auth URL and authorize your app. Then get the PIN the service will deliver toyour user and authorize the token:

>>> pin = '123456'>>> token = http.authorize_token(pin)

Use this token to store the key, secret and pin in a safe place to use it from now on. Then inform to Turpial-HTTPOAuth that you have access granted:

>>> http.set_token_info(token.key, token.secret, token.verifier)

•To use an existing token to fetch a resource create a new TurpialHTTPOAuth object and pass the user_key,user_secret and pin (verifier):

>>> user_key = 'example'>>> user_secret = 'example'>>> verifier = 'example'>>> http = TurpialHTTPOAuth(base_url, oauth_options, user_key, user_secret,... verifier)

•To perform a request use the get or post method:

>>> http.get('/my_first/end_point', args={'arg1': '1'}, _format='json')>>> http.post('/my_second/end_point', args={'arg1': '2'}, _format='json')

__init__(base_url, oauth_options, user_key=None, user_secret=None, verifier=None, proxies=None,timeout=None)

__module__ = ‘libturpial.lib.http’

32 Chapter 3. Reference

Page 37: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

libturpial Documentation, Release 1.7.0

authorize_token(pin)Uses the pin returned by the service to authorize the current token. Returns an oauth.OAuthTokenobject.

request_token()Ask to the service for a fresh new token. Returns an URL that the user must access in order to authorizethe client.

request_xauth_token(username, password)Request a limited token without using the whole OAuth flow, it just uses the username and passwordthrough xAuth

set_token_info(user_key, user_secret, verifier)Creates a new token using the existing user_key, user_secret and verifier. Use this method

sign_request(httpreq)Signs the httpreq for OAuth using the previously defined user token

TurpialHTTPBasicAuth

class libturpial.lib.http.TurpialHTTPBasicAuth(base_url, proxies=None, timeout=None)Implementation of TurpialHTTPBase for the HTTP Basic Authentication. base_url is the part of the URLcommon for all your requests. username and password are the username credentials. proxies and timeout workin the same way that in libturpial.api.interfaces.http.TurpialHTTPBase.

proxies and timeout work in the same way that in libturpial.api.interfaces.http.TurpialHTTPBase.

•To fetch a resource using Basic Authentication just create a new TurpialHTTPBasicAuth object and passthe user credentials as parameters:

>>> base_url = 'http://identi.ca/api'>>> username = 'example'>>> password = 'example'>>> http = TurpialHTTPBasicAuth(base_url, username, password)

Then perform the request desired using get or post methods:

>>> http.get('/my_first/end_point', args={'arg1': '1'}, _format='json')>>> http.post('/my_second/end_point', args={'arg1': '2'}, _format='json')

__init__(base_url, proxies=None, timeout=None)

__module__ = ‘libturpial.lib.http’

set_user_info(username, password)Set the username and password for the basic authentication

sign_request(httpreq)The httpreq is signed using the Authorization header as documented in the Basic Access AuthenticationWiki

TurpialHTTPRequest

class libturpial.lib.http.TurpialHTTPRequest(method, uri, headers=None, params=None,_format=’json’, secure=False, files=None)

Encapsulate an URL request into a python object

3.2. Lib 33

Page 38: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

libturpial Documentation, Release 1.7.0

Protocols

Twitter

class libturpial.lib.protocols.twitter.twitter.MainTwitter implementation for libturpial

__init__()

__module__ = ‘libturpial.lib.protocols.twitter.twitter’

authorize_token(pin)

available_trend_locations()

block(screen_name)

check_for_errors(response)Receives a json response and raise an exception if there are errors

destroy_direct_message(direct_message_id)

destroy_status(status_id)

follow(screen_name, by_id=False)

get_blocked()

get_conversation(status_id)

get_directs(count=20, since_id=None)

get_directs_sent(count=20, since_id=None)

get_entities(tweet)

get_favorites(count=20)

get_followers(only_id=False)

get_following(only_id=False)

get_list_statuses(list_id, count=20, since_id=None)

get_lists(username)

get_oauth_token()

get_profile(user)

get_profile_image(user)

get_public_timeline(count=20, since_id=None)

get_repeaters(status_id, only_username=False)

get_replies(count=20, since_id=None)

get_sent(count=20, since_id=None)

get_status(status_id)

get_timeline(count=20, since_id=None)

initialize_http()

is_friend(user)

json_to_list(response)

34 Chapter 3. Reference

Page 39: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

libturpial Documentation, Release 1.7.0

json_to_profile(response)

json_to_status(response, column_id=’‘, type_=1)

json_to_trend(response)

json_to_trend_location(response)

mark_as_favorite(status_id)

repeat_status(status_id)

report_as_spam(screen_name)

request_token()

search(query, count=20, since_id=None, extra=None)

send_direct_message(screen_name, text)

setup_user_credentials(account_id, key, secret, verifier=None)

setup_user_info(account_id)

trends(location_id)

unblock(screen_name)

unfollow(screen_name)

unmark_as_favorite(status_id)

update_profile(fullname=None, url=None, bio=None, location=None)

update_profile_image(image_path)

update_status(text, in_reply_id=None, media=None)

verify_credentials()

verify_credentials_provider(format_=’json’)

Identi.ca

class libturpial.lib.protocols.identica.identica.MainIdenti.ca implementation for libturpial

GROUP_PATTERN = <_sre.SRE_Pattern object>

_Main__build_basic_args(count, since_id)

__init__()

__module__ = ‘libturpial.lib.protocols.identica.identica’

block(screen_name)

check_for_errors(response)Receives a json response and raise an exception if there are errors

destroy_direct_message(direct_message_id)

destroy_status(status_id)

follow(screen_name, by_id=False)

get_blocked()

get_conversation(status_id)

3.2. Lib 35

Page 40: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

libturpial Documentation, Release 1.7.0

get_directs(count=20, since_id=None)

get_directs_sent(count=20, since_id=None)

get_entities(status)

get_favorites(count=20)

get_followers(only_id=False)

get_following(only_id=False)

get_list_statuses(list_id, user, count=20, since_id=None)

get_lists(username)

get_profile(user)

get_profile_image(user)

get_public_timeline(count=20, since_id=None)

get_rate_limits()

get_replies(count=20, since_id=None)

get_sent(count=20, since_id=None)

get_status(status_id)

get_timeline(count=20, since_id=None)

initialize_http()

is_friend(user)

json_to_profile(response)

json_to_status(response, column_id=’‘, type_=1)

mark_as_favorite(status_id)

repeat_status(status_id)

search(query, count=20, since_id=None)

send_direct_message(screen_name, text)

setup_user_credentials(account_id, username, password)

unblock(screen_name)

unfollow(screen_name)

unmark_as_favorite(status_id)

update_profile(p_args)

update_status(text, in_reply_id=None)

verify_credentials()

Configuration

This module contains all the classes involved in Turpial configuration. All files are stored on ~/.config/turpial/ andcache is stored on ~/.cache/turpial/. Absolutes directories will vary depending on the operating system.

In configuration folder you will find:

36 Chapter 3. Reference

Page 41: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

libturpial Documentation, Release 1.7.0

• accounts: A directory where live sub-directories with the configuration of every single account.

• config: The global configuration file. Here is stored all the settings related to the application behavior (even forthe graphic interface)

• filtered: A plain text file where libturpial stores all filters applied to timelines.

• friends: A plain text file that contains the list of all the friends of all the accounts registered

Module to handle basic configuration of Turpial

class libturpial.config.AppConfig(basedir=’/home/docs/.config/turpial’, default=None)Handle app configuration

class libturpial.config.ConfigBase(default=None)Base configuration

register_extra_option(section, option, default_value)Registers a new configuration option under a specified section with a default value. Returns a maping withthe new option as a key and the value

Constants

DEFAULT_TIMEOUTDefault time that TurpialHTTPBase waits until killing a request. Value: 20 (seconds)

FORMAT_XMLConstant to identify XML requests

FORMAT_JSONConstant to identify JSON requests

Exceptions

Module to handle custom exceptions for libturpial

exception libturpial.exceptions.URLShortenError(message)

exception libturpial.exceptions.UploadImageError(message=None)

exception libturpial.exceptions.EmptyOAuthCredentials

exception libturpial.exceptions.EmptyBasicCredentials

exception libturpial.exceptions.ErrorCreatingAccount

exception libturpial.exceptions.ErrorLoadingAccount(message)

exception libturpial.exceptions.AccountNotAuthenticated

exception libturpial.exceptions.AccountSuspended

exception libturpial.exceptions.AccountAlreadyRegistered

exception libturpial.exceptions.ColumnAlreadyRegistered

exception libturpial.exceptions.StatusMessageTooLong

exception libturpial.exceptions.StatusDuplicated

exception libturpial.exceptions.ResourceNotFound

3.4. Constants 37

Page 42: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

libturpial Documentation, Release 1.7.0

exception libturpial.exceptions.UserListNotFound

exception libturpial.exceptions.ServiceOverCapacity

exception libturpial.exceptions.InternalServerError

exception libturpial.exceptions.ServiceDown

exception libturpial.exceptions.InvalidOrMissingCredentials

exception libturpial.exceptions.InvalidOrMissingArguments

exception libturpial.exceptions.ExpressionAlreadyFiltered

exception libturpial.exceptions.BadOAuthTimestamp

exception libturpial.exceptions.ErrorSendingDirectMessage(message)

exception libturpial.exceptions.RateLimitExceeded

exception libturpial.exceptions.InvalidOAuthToken

exception libturpial.exceptions.URLShortenError(message)

exception libturpial.exceptions.NoURLToShorten

exception libturpial.exceptions.URLAlreadyShort

exception libturpial.exceptions.PreviewServiceNotSupported

exception libturpial.exceptions.UploadImageError(message=None)

exception libturpial.exceptions.NotSupported

38 Chapter 3. Reference

Page 43: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

CHAPTER 4

Further information

For more information about the development process, please go to:

http://wiki.turpial.org.ve/dev:welcome

39

Page 44: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

libturpial Documentation, Release 1.7.0

40 Chapter 4. Further information

Page 45: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

Python Module Index

llibturpial, 11libturpial.config, 37libturpial.exceptions, 37libturpial.lib.http, 30

41

Page 46: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

libturpial Documentation, Release 1.7.0

42 Python Module Index

Page 47: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

Index

Symbols_Main__build_basic_args() (lib-

turpial.lib.protocols.identica.identica.Mainmethod), 35

__init__() (libturpial.lib.http.TurpialHTTPBase method),31

__init__() (libturpial.lib.http.TurpialHTTPBasicAuthmethod), 33

__init__() (libturpial.lib.http.TurpialHTTPOAuthmethod), 32

__init__() (libturpial.lib.interfaces.protocol.Protocolmethod), 23

__init__() (libturpial.lib.interfaces.service.GenericServicemethod), 30

__init__() (libturpial.lib.protocols.identica.identica.Mainmethod), 35

__init__() (libturpial.lib.protocols.twitter.twitter.Mainmethod), 34

__module__ (libturpial.lib.http.TurpialHTTPBase at-tribute), 31

__module__ (libturpial.lib.http.TurpialHTTPBasicAuthattribute), 33

__module__ (libturpial.lib.http.TurpialHTTPOAuth at-tribute), 32

__module__ (libturpial.lib.interfaces.protocol.Protocolattribute), 23

__module__ (libturpial.lib.interfaces.service.GenericServiceattribute), 30

__module__ (libturpial.lib.protocols.identica.identica.Mainattribute), 35

__module__ (libturpial.lib.protocols.twitter.twitter.Mainattribute), 34

_get_request() (libturpial.lib.interfaces.service.GenericServicemethod), 30

_json_request() (libturpial.lib.interfaces.service.GenericServicemethod), 30

_parse_xml() (libturpial.lib.interfaces.service.GenericServicemethod), 30

_quote_url() (libturpial.lib.interfaces.service.GenericService

method), 30

AAccount (class in libturpial.api.models.account), 16AccountAlreadyRegistered, 37AccountManager (class in lib-

turpial.api.managers.accountmanager), 22AccountNotAuthenticated, 37accounts() (libturpial.api.managers.accountmanager.AccountManager

method), 22AccountSuspended, 37add_friend() (libturpial.api.core.Core method), 15all_columns() (libturpial.api.core.Core method), 12AppConfig (class in libturpial.config), 37authorize_oauth_access() (lib-

turpial.api.models.account.Account method),17

authorize_token() (libturpial.lib.http.TurpialHTTPOAuthmethod), 32

authorize_token() (libturpial.lib.protocols.twitter.twitter.Mainmethod), 34

available_columns() (libturpial.api.core.Core method), 12available_trend_locations() (lib-

turpial.lib.interfaces.protocol.Protocolmethod), 23

available_trend_locations() (lib-turpial.lib.protocols.twitter.twitter.Mainmethod), 34

availables() (libturpial.lib.interfaces.protocol.Protocolstatic method), 24

BBadOAuthTimestamp, 38block() (libturpial.api.core.Core method), 14block() (libturpial.lib.interfaces.protocol.Protocol

method), 24block() (libturpial.lib.protocols.identica.identica.Main

method), 35block() (libturpial.lib.protocols.twitter.twitter.Main

method), 34

43

Page 48: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

libturpial Documentation, Release 1.7.0

broadcast_status() (libturpial.api.core.Core method), 13

Ccheck_for_errors() (lib-

turpial.lib.protocols.identica.identica.Mainmethod), 35

check_for_errors() (lib-turpial.lib.protocols.twitter.twitter.Mainmethod), 34

Client (class in libturpial.api.models.client), 20Column (class in libturpial.api.models.column), 18ColumnAlreadyRegistered, 37ColumnManager (class in lib-

turpial.api.managers.columnmanager), 22columns() (libturpial.api.managers.columnmanager.ColumnManager

method), 23ConfigBase (class in libturpial.config), 37convert_time() (libturpial.lib.interfaces.protocol.Protocol

method), 24Core (class in libturpial.api.core), 11

DDEFAULT_TIMEOUT (built-in variable), 37delete_cache() (libturpial.api.core.Core method), 15delete_cache() (libturpial.api.models.account.Account

method), 17delete_current_config() (libturpial.api.core.Core method),

15destroy_direct_message() (libturpial.api.core.Core

method), 14destroy_direct_message() (lib-

turpial.lib.interfaces.protocol.Protocolmethod), 24

destroy_direct_message() (lib-turpial.lib.protocols.identica.identica.Mainmethod), 35

destroy_direct_message() (lib-turpial.lib.protocols.twitter.twitter.Mainmethod), 34

destroy_status() (libturpial.api.core.Core method), 13destroy_status() (libturpial.lib.interfaces.protocol.Protocol

method), 24destroy_status() (libturpial.lib.protocols.identica.identica.Main

method), 35destroy_status() (libturpial.lib.protocols.twitter.twitter.Main

method), 34do_service() (libturpial.lib.interfaces.service.GenericService

method), 30

EEmptyBasicCredentials, 37EmptyOAuthCredentials, 37Entity (class in libturpial.api.models.entity), 20ErrorCreatingAccount, 37

ErrorLoadingAccount, 37ErrorSendingDirectMessage, 38ExpressionAlreadyFiltered, 38

Ffetch() (libturpial.api.models.account.Account method),

17fetch_friends() (libturpial.api.models.account.Account

method), 17fetch_image() (libturpial.api.core.Core method), 12follow() (libturpial.api.core.Core method), 14follow() (libturpial.lib.interfaces.protocol.Protocol

method), 24follow() (libturpial.lib.protocols.identica.identica.Main

method), 35follow() (libturpial.lib.protocols.twitter.twitter.Main

method), 34FORMAT_JSON (built-in variable), 37FORMAT_XML (built-in variable), 37

GGenericService (class in libturpial.lib.interfaces.service),

30get() (libturpial.api.managers.accountmanager.AccountManager

method), 22get() (libturpial.api.managers.columnmanager.ColumnManager

method), 23get() (libturpial.lib.http.TurpialHTTPBase method), 31get_all_friends_list() (libturpial.api.core.Core method),

13get_available_trend_locations() (libturpial.api.core.Core

method), 14get_blocked() (libturpial.lib.interfaces.protocol.Protocol

method), 24get_blocked() (libturpial.lib.protocols.identica.identica.Main

method), 35get_blocked() (libturpial.lib.protocols.twitter.twitter.Main

method), 34get_cache_size() (libturpial.api.core.Core method), 15get_cache_size() (libturpial.api.models.account.Account

method), 17get_column_statuses() (libturpial.api.core.Core method),

13get_columns() (libturpial.api.models.account.Account

method), 17get_conversation() (lib-

turpial.lib.interfaces.protocol.Protocolmethod), 24

get_conversation() (lib-turpial.lib.protocols.identica.identica.Mainmethod), 35

get_conversation() (lib-turpial.lib.protocols.twitter.twitter.Mainmethod), 34

44 Index

Page 49: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

libturpial Documentation, Release 1.7.0

get_directs() (libturpial.lib.interfaces.protocol.Protocolmethod), 24

get_directs() (libturpial.lib.protocols.identica.identica.Mainmethod), 35

get_directs() (libturpial.lib.protocols.twitter.twitter.Mainmethod), 34

get_directs_sent() (libturpial.lib.interfaces.protocol.Protocolmethod), 25

get_directs_sent() (libturpial.lib.protocols.identica.identica.Mainmethod), 36

get_directs_sent() (libturpial.lib.protocols.twitter.twitter.Mainmethod), 34

get_entities() (libturpial.lib.interfaces.protocol.Protocolmethod), 25

get_entities() (libturpial.lib.protocols.identica.identica.Mainmethod), 36

get_entities() (libturpial.lib.protocols.twitter.twitter.Mainmethod), 34

get_favorites() (libturpial.lib.interfaces.protocol.Protocolmethod), 25

get_favorites() (libturpial.lib.protocols.identica.identica.Mainmethod), 36

get_favorites() (libturpial.lib.protocols.twitter.twitter.Mainmethod), 34

get_followers() (libturpial.api.core.Core method), 13get_followers() (libturpial.lib.interfaces.protocol.Protocol

method), 25get_followers() (libturpial.lib.protocols.identica.identica.Main

method), 36get_followers() (libturpial.lib.protocols.twitter.twitter.Main

method), 34get_following() (libturpial.api.core.Core method), 13get_following() (libturpial.lib.interfaces.protocol.Protocol

method), 25get_following() (libturpial.lib.protocols.identica.identica.Main

method), 36get_following() (libturpial.lib.protocols.twitter.twitter.Main

method), 34get_int_time() (libturpial.lib.interfaces.protocol.Protocol

method), 25get_list_statuses() (libturpial.lib.interfaces.protocol.Protocol

method), 25get_list_statuses() (libturpial.lib.protocols.identica.identica.Main

method), 36get_list_statuses() (libturpial.lib.protocols.twitter.twitter.Main

method), 34get_lists() (libturpial.lib.interfaces.protocol.Protocol

method), 25get_lists() (libturpial.lib.protocols.identica.identica.Main

method), 36get_lists() (libturpial.lib.protocols.twitter.twitter.Main

method), 34get_max_statuses_per_column() (libturpial.api.core.Core

method), 15

get_mentions() (libturpial.api.models.status.Statusmethod), 19

get_oauth_token() (libturpial.lib.protocols.twitter.twitter.Mainmethod), 34

get_profile() (libturpial.lib.interfaces.protocol.Protocolmethod), 26

get_profile() (libturpial.lib.protocols.identica.identica.Mainmethod), 36

get_profile() (libturpial.lib.protocols.twitter.twitter.Mainmethod), 34

get_profile_image() (libturpial.api.core.Core method), 14get_profile_image() (lib-

turpial.lib.interfaces.protocol.Protocolmethod), 26

get_profile_image() (lib-turpial.lib.protocols.identica.identica.Mainmethod), 36

get_profile_image() (lib-turpial.lib.protocols.twitter.twitter.Mainmethod), 34

get_protocol_id() (libturpial.api.models.profile.Profilemethod), 20

get_protocol_id() (libturpial.api.models.status.Statusmethod), 19

get_proxy() (libturpial.api.core.Core method), 15get_public_timeline() (libturpial.api.core.Core method),

13get_public_timeline() (lib-

turpial.lib.interfaces.protocol.Protocolmethod), 26

get_public_timeline() (lib-turpial.lib.protocols.identica.identica.Mainmethod), 36

get_public_timeline() (lib-turpial.lib.protocols.twitter.twitter.Mainmethod), 34

get_rate_limits() (libturpial.lib.interfaces.protocol.Protocolmethod), 26

get_rate_limits() (libturpial.lib.protocols.identica.identica.Mainmethod), 36

get_repeaters() (libturpial.lib.interfaces.protocol.Protocolmethod), 26

get_repeaters() (libturpial.lib.protocols.twitter.twitter.Mainmethod), 34

get_replies() (libturpial.lib.interfaces.protocol.Protocolmethod), 26

get_replies() (libturpial.lib.protocols.identica.identica.Mainmethod), 36

get_replies() (libturpial.lib.protocols.twitter.twitter.Mainmethod), 34

get_sent() (libturpial.lib.interfaces.protocol.Protocolmethod), 26

get_sent() (libturpial.lib.protocols.identica.identica.Mainmethod), 36

Index 45

Page 50: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

libturpial Documentation, Release 1.7.0

get_sent() (libturpial.lib.protocols.twitter.twitter.Mainmethod), 34

get_single_account() (libturpial.api.core.Core method),13

get_single_column() (libturpial.api.core.Core method),13

get_single_status() (libturpial.api.core.Core method), 14get_socket_timeout() (libturpial.api.core.Core method),

15get_source() (libturpial.api.models.status.Status method),

19get_status() (libturpial.lib.interfaces.protocol.Protocol

method), 27get_status() (libturpial.lib.protocols.identica.identica.Main

method), 36get_status() (libturpial.lib.protocols.twitter.twitter.Main

method), 34get_status_avatar() (libturpial.api.core.Core method), 14get_str_time() (libturpial.lib.interfaces.protocol.Protocol

method), 27get_timeline() (libturpial.lib.interfaces.protocol.Protocol

method), 27get_timeline() (libturpial.lib.protocols.identica.identica.Main

method), 36get_timeline() (libturpial.lib.protocols.twitter.twitter.Main

method), 34get_trending_topics() (libturpial.api.core.Core method),

15get_user_profile() (libturpial.api.core.Core method), 13GROUP_PATTERN (lib-

turpial.lib.protocols.identica.identica.Mainattribute), 35

IIDENTICA (libturpial.lib.interfaces.protocol.Protocol at-

tribute), 23initialize_http() (libturpial.lib.interfaces.protocol.Protocol

method), 27initialize_http() (libturpial.lib.protocols.identica.identica.Main

method), 36initialize_http() (libturpial.lib.protocols.twitter.twitter.Main

method), 34InternalServerError, 38InvalidOAuthToken, 38InvalidOrMissingArguments, 38InvalidOrMissingCredentials, 38is_authenticated() (libturpial.api.models.account.Account

method), 17is_direct() (libturpial.api.models.status.Status method),

19is_friend() (libturpial.lib.interfaces.protocol.Protocol

method), 27is_friend() (libturpial.lib.protocols.identica.identica.Main

method), 36

is_friend() (libturpial.lib.protocols.twitter.twitter.Mainmethod), 34

is_image() (libturpial.api.models.media.Media method),21

is_map() (libturpial.api.models.media.Media method), 21is_me() (libturpial.api.models.profile.Profile method), 20is_muted() (libturpial.api.core.Core method), 15is_registered() (libturpial.api.managers.columnmanager.ColumnManager

method), 23is_video() (libturpial.api.models.media.Media method),

21

Jjson_to_list() (libturpial.lib.interfaces.protocol.Protocol

method), 27json_to_list() (libturpial.lib.protocols.twitter.twitter.Main

method), 34json_to_profile() (libturpial.lib.interfaces.protocol.Protocol

method), 27json_to_profile() (libturpial.lib.protocols.identica.identica.Main

method), 36json_to_profile() (libturpial.lib.protocols.twitter.twitter.Main

method), 34json_to_ratelimit() (lib-

turpial.lib.interfaces.protocol.Protocolmethod), 28

json_to_status() (libturpial.lib.interfaces.protocol.Protocolmethod), 28

json_to_status() (libturpial.lib.protocols.identica.identica.Mainmethod), 36

json_to_status() (libturpial.lib.protocols.twitter.twitter.Mainmethod), 35

json_to_trend() (libturpial.lib.protocols.twitter.twitter.Mainmethod), 35

json_to_trend_location() (lib-turpial.lib.protocols.twitter.twitter.Mainmethod), 35

Llibturpial (module), 11libturpial.config (module), 37libturpial.exceptions (module), 37libturpial.lib.http (module), 30List (class in libturpial.api.models.list), 18list() (libturpial.api.managers.accountmanager.AccountManager

method), 22list_accounts() (libturpial.api.core.Core method), 12list_filters() (libturpial.api.core.Core method), 15list_protocols() (libturpial.api.core.Core method), 12load() (libturpial.api.managers.accountmanager.AccountManager

method), 22load() (libturpial.api.models.account.Account static

method), 17

46 Index

Page 51: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

libturpial Documentation, Release 1.7.0

MMain (class in libturpial.lib.protocols.identica.identica),

35Main (class in libturpial.lib.protocols.twitter.twitter), 34mark_as_favorite() (lib-

turpial.lib.interfaces.protocol.Protocolmethod), 28

mark_as_favorite() (lib-turpial.lib.protocols.identica.identica.Mainmethod), 36

mark_as_favorite() (lib-turpial.lib.protocols.twitter.twitter.Mainmethod), 35

mark_status_as_favorite() (libturpial.api.core.Coremethod), 14

Media (class in libturpial.api.models.media), 21mute() (libturpial.api.core.Core method), 14

Nnew() (libturpial.api.models.account.Account static

method), 16new_from_params() (lib-

turpial.api.models.account.Account staticmethod), 17

new_image() (libturpial.api.models.media.Media staticmethod), 21

NotSupported, 38NoURLToShorten, 38

Ppost() (libturpial.lib.http.TurpialHTTPBase method), 31PreviewServiceNotSupported, 38Profile (class in libturpial.api.models.profile), 19Protocol (class in libturpial.lib.interfaces.protocol), 23Proxy (class in libturpial.api.models.proxy), 21purge_config() (libturpial.api.models.account.Account

method), 17

RRateLimitExceeded, 38register() (libturpial.api.managers.accountmanager.AccountManager

method), 22register() (libturpial.api.managers.columnmanager.ColumnManager

method), 23register_account() (libturpial.api.core.Core method), 12register_column() (libturpial.api.core.Core method), 12register_extra_option() (libturpial.config.ConfigBase

method), 37register_new_config_option() (libturpial.api.core.Core

method), 15registered_accounts() (libturpial.api.core.Core method),

13registered_columns() (libturpial.api.core.Core method),

13

registered_columns_by_order() (libturpial.api.core.Coremethod), 13

remove_friend() (libturpial.api.core.Core method), 15repeat_status() (libturpial.api.core.Core method), 14repeat_status() (libturpial.lib.interfaces.protocol.Protocol

method), 28repeat_status() (libturpial.lib.protocols.identica.identica.Main

method), 36repeat_status() (libturpial.lib.protocols.twitter.twitter.Main

method), 35report_as_spam() (libturpial.api.core.Core method), 14report_as_spam() (libturpial.lib.interfaces.protocol.Protocol

method), 28report_as_spam() (libturpial.lib.protocols.twitter.twitter.Main

method), 35request() (libturpial.lib.http.TurpialHTTPBase method),

31request_access() (libturpial.lib.interfaces.protocol.Protocol

method), 28request_oauth_access() (lib-

turpial.api.models.account.Account method),17

request_token() (libturpial.lib.http.TurpialHTTPOAuthmethod), 33

request_token() (libturpial.lib.protocols.twitter.twitter.Mainmethod), 35

request_xauth_token() (lib-turpial.lib.http.TurpialHTTPOAuth method),33

ResourceNotFound, 37

Ssave() (libturpial.api.models.account.Account method),

17save_content() (libturpial.api.models.media.Media

method), 21save_filters() (libturpial.api.core.Core method), 15search() (libturpial.api.core.Core method), 14search() (libturpial.lib.interfaces.protocol.Protocol

method), 28search() (libturpial.lib.protocols.identica.identica.Main

method), 36search() (libturpial.lib.protocols.twitter.twitter.Main

method), 35send_direct_message() (libturpial.api.core.Core method),

14send_direct_message() (lib-

turpial.lib.interfaces.protocol.Protocolmethod), 28

send_direct_message() (lib-turpial.lib.protocols.identica.identica.Mainmethod), 36

send_direct_message() (lib-turpial.lib.protocols.twitter.twitter.Main

Index 47

Page 52: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

libturpial Documentation, Release 1.7.0

method), 35ServiceDown, 38ServiceOverCapacity, 38set_proxy() (libturpial.lib.http.TurpialHTTPBase

method), 31set_timeout() (libturpial.lib.http.TurpialHTTPBase

method), 31set_token_info() (libturpial.lib.http.TurpialHTTPOAuth

method), 33set_user_info() (libturpial.lib.http.TurpialHTTPBasicAuth

method), 33setup_user_credentials() (lib-

turpial.lib.interfaces.protocol.Protocolmethod), 29

setup_user_credentials() (lib-turpial.lib.protocols.identica.identica.Mainmethod), 36

setup_user_credentials() (lib-turpial.lib.protocols.twitter.twitter.Mainmethod), 35

setup_user_info() (libturpial.lib.protocols.twitter.twitter.Mainmethod), 35

sign_request() (libturpial.lib.http.TurpialHTTPBasemethod), 31

sign_request() (libturpial.lib.http.TurpialHTTPBasicAuthmethod), 33

sign_request() (libturpial.lib.http.TurpialHTTPOAuthmethod), 33

Status (class in libturpial.api.models.status), 18StatusDuplicated, 37StatusMessageTooLong, 37

Ttrends() (libturpial.lib.interfaces.protocol.Protocol

method), 29trends() (libturpial.lib.protocols.twitter.twitter.Main

method), 35TurpialHTTPBase (class in libturpial.lib.http), 30TurpialHTTPBasicAuth (class in libturpial.lib.http), 33TurpialHTTPOAuth (class in libturpial.lib.http), 31TurpialHTTPRequest (class in libturpial.lib.http), 33TWITTER (libturpial.lib.interfaces.protocol.Protocol at-

tribute), 23

Uunblock() (libturpial.api.core.Core method), 14unblock() (libturpial.lib.interfaces.protocol.Protocol

method), 29unblock() (libturpial.lib.protocols.identica.identica.Main

method), 36unblock() (libturpial.lib.protocols.twitter.twitter.Main

method), 35unfollow() (libturpial.api.core.Core method), 14

unfollow() (libturpial.lib.interfaces.protocol.Protocolmethod), 29

unfollow() (libturpial.lib.protocols.identica.identica.Mainmethod), 36

unfollow() (libturpial.lib.protocols.twitter.twitter.Mainmethod), 35

unmark_as_favorite() (lib-turpial.lib.interfaces.protocol.Protocolmethod), 29

unmark_as_favorite() (lib-turpial.lib.protocols.identica.identica.Mainmethod), 36

unmark_as_favorite() (lib-turpial.lib.protocols.twitter.twitter.Mainmethod), 35

unmark_status_as_favorite() (libturpial.api.core.Coremethod), 14

unmute() (libturpial.api.core.Core method), 14unregister() (libturpial.api.managers.accountmanager.AccountManager

method), 22unregister() (libturpial.api.managers.columnmanager.ColumnManager

method), 23unregister_account() (libturpial.api.core.Core method),

12unregister_column() (libturpial.api.core.Core method), 12update_profile() (libturpial.api.core.Core method), 14update_profile() (libturpial.api.models.account.Account

method), 17update_profile() (libturpial.lib.interfaces.protocol.Protocol

method), 29update_profile() (libturpial.lib.protocols.identica.identica.Main

method), 36update_profile() (libturpial.lib.protocols.twitter.twitter.Main

method), 35update_profile_image() (libturpial.api.core.Core method),

15update_profile_image() (lib-

turpial.lib.interfaces.protocol.Protocolmethod), 29

update_profile_image() (lib-turpial.lib.protocols.twitter.twitter.Mainmethod), 35

update_status() (libturpial.api.core.Core method), 13update_status() (libturpial.lib.interfaces.protocol.Protocol

method), 29update_status() (libturpial.lib.protocols.identica.identica.Main

method), 36update_status() (libturpial.lib.protocols.twitter.twitter.Main

method), 35UploadImageError, 37, 38URLAlreadyShort, 38URLShortenError, 37, 38UserListNotFound, 37

48 Index

Page 53: Release 1.7 · 2019. 4. 2. · libturpial Documentation, Release 1.7.0 libturpial is a library that handles multiple microblogging protocols. It implements a lot of features and aims

libturpial Documentation, Release 1.7.0

Vverify_credentials() (lib-

turpial.lib.interfaces.protocol.Protocolmethod), 30

verify_credentials() (lib-turpial.lib.protocols.identica.identica.Mainmethod), 36

verify_credentials() (lib-turpial.lib.protocols.twitter.twitter.Mainmethod), 35

verify_credentials_provider() (lib-turpial.lib.interfaces.protocol.Protocolmethod), 30

verify_credentials_provider() (lib-turpial.lib.protocols.twitter.twitter.Mainmethod), 35

verify_friendship() (libturpial.api.core.Core method), 14

Index 49


Recommended