Python package to access the Opera Link API
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


pyoperalink - Python Opera Link Client



This is the Opera Link Public API client library for Python. It provides utilities to get and manipulate Opera Link datatypes. All applications must provide the library with its application key received from The library takes care of authorizing the user and giving easy access to get and modify his Opera Link data.


oauth2 module


You can install pyoperalink either via the Python Package Index (PyPI) or from source.

To install using pip:

$ pip install pyoperalink

To install using easy_install:

$ easy_install pyoperalink

If you have downloaded a source you can install it by doing the following,:

$ python build # python install # as root


To receive data from server following get methods can be invoked on LinkClient object:

To get a specific item:

  • get_bookmark(item_id)
  • get_note(item_id)
  • get_speeddial(item_id)

Or to get lists of items, either at root level, or for a specific folder(where applicable):

  • get_bookmarks(item_id=None)
  • get_notes(item_id=None)
  • get_speeddials()

All of the above methods will return instances of the corresponding Opera Link datatype class.

High level interface operates on instances of Opera Link dataype classes (listed above in Classes section).

  • add(item)
  • add_to_folder(item, destination)
  • move_into(item, destination)
  • move_before(item, reference_item)
  • move_after(item, reference)

Low level interface operates on parameter item_id of element and objects parameters passed as dictionary. Generally, you wouldn't need to directly call those methods, use the methods of the client and the dataype classes as specified above.

List of accepted parameters for every datatype can be found in documentation for corresponding class.

Methods of LinkClient:

  • create_bookmark(item_id, params)
  • move_bookmark(item_id, relative_position, reference_item=None)
  • delete_bookmark(item_id)
  • trash_bookmark(item_id)
  • update_bookmark(item_id, params)
  • create_note(item_id, params)
  • move_note(item_id, , relative_position, reference_item=None)
  • delete_note(item_id)
  • trash_note(item_id)
  • update_note(item_id, params)
  • create_speeddial(item_id, params)
  • delete_speeddial(item_id)
  • update_speeddial(item_id, params)

Except from the delete method, all calls will return server response as a dictionary of the item's fields and their values.


To get access to the user's data OAuth 1.0a protocol based authization method is preformed. To make it work for your application, it must be registered at where you are going to receive consumer key and consumer secret. It can be registered either as a Desktop or a Web application. If you register the latter, then you must specify a callback URL. That is the adress where the user and the generated token will be returnedback into your web application, after autorization is complete.


>>> import pyoperalink


Typical workflow to access Opera Link data of a new user:

# Create a new OAuth handler with consumer key and consumer secret, # received when registering the application on. # Pass the callback URL if you're making a web application #

>>> from pyoperalink.auth import OAuth
>>> auth = OAuth('consumer_key',
>>> ....'consumer_secret')

# Get address to the authorization website where user can grant access to the # application, pass callback URL if any.

>>> auth.get_authorization_url(

# Now your application should redirect user on the address above

# After the user has granted access to the application, complete # the autorization, using the verifer code you received. # Keep this token, using whatever means you want. You need it # every time you want to access the service.

>>> token = auth.get_access_token(verifier)

# To access Opera Link data of a user who has already generated # access token:

>>> auth = OAuth('consumer_key',
>>> ....'consumer_secret')
>>> auth.set_access_token("token", "token_secret")

# Now you can use Opera Link Public API

>>> from pyoperalink.client import LinkClient
>>> client = LinkClient(auth)

Accessing the user data

Examples for bookmarks:

>>> from pyoperalink import datatypes

# get list of all bookmark elements from the server

>>> bookmarks = client.get_bookmarks()
>>> len(bookmarks)
>>> isinstance(bookmarks[0], Bookmark)
>>> bookmarks[0].uri

# move some element to a trash folder

>>> bookmarks[-1].trash()

# check if an element in the list is a folder

>>> bookmarks[2].is_folder()

# Fetch the items contained in the folder

>>> children = bookmarks[2].children
>>> len(children)

# Directly fetch the items contained in a specific folder

>>> children = client.get_bokmarks("4E1601F6F30511DB9CA51FD19A7AAECA")
>>> len(children)

# Move one of the bookmarks into a folder

>>> bookmarks[1].move(bookmarks[2], "into")

# Or using the client shortcut method

>>> client.move_into(bookmarks[1], bookmarks[2])

# Greate a new bookmark and add it to the storage

>>> sample_bookmark = datatypes.Bookmark(title='sample_title', uri='')
>>> client.add(sample_bookmark)

# Or add it straight into an existing folder:

>>> sample_bookmark = datatypes.Bookmark(title='sample_title', uri='')
>>> client.add_to_folder(sample_bookmark, bookmarks[2])

# Modify bookmark properties

>>> bookmarks[2].title = 'New folder title'
# And save the changes to the server
>>> bookmarks[2].update()

Examples for notes:

# get list of notes from the server

>>> notes = client.get_notes()
>>> len(notes)

# check if element is a folder

>>> notes[2].is_folder()
>>> children = notes[2].children
>>> len(children)

# move one of the notes to another folder

>>> client.move_into(notes[3], notes[2])
>>> len(client.get_notes(notes[2].id))
>>> sample_note = datatypes.Note(content='sample note content')
>>> client.add_to_folder(sample_note, notes[2])
>>> len(notes[2].children)

Examples for speed dials:

# get list of speed dials from the server

>>> dials = client.get_speeddials()
>>> len(dials)

# delete one of the speed dials

>>> dials[1].delete()
>>> dials = client.get_speeddials()
>>> len(dials)

# insert new dial at position 1

>>> sample_dial = datatypes.SpeedDial(id=1, title='sample note content', uri='')
>>> client.add(sample_dial)
>>> sample_dial.uri
>>> sample_dial.position


This software is licensed under the BSD License. See the LICENSE file in the top distribution directory for the full license text.