YOURLS Client

This small library was created to provide an easy interface to YOURLS from a python program.

Simple example of shortening a URL:

import yourls.client

c = yourls.client.YourlsClient('http://localhost/yourls/yourls-api.php', username='username', password='password')
url = c.shorten('http://autoqa.fedorahosted.org/autoqa', custom='autoqa')

API Documentation

exception client.YourlsKeywordError(url, message)[source]

Used when there are keyword conflicts in requested custom URLs

class yourls.client.YourlsClient(apiurl, username=None, password=None)[source]
shorten(url, custom=None)[source]

Request a shortened URL from YOURLS with an optional keyword request

Parameters:
  • url (str) – The URL to shorten
  • custom (str) – The custom keyword to request
Returns:

str – The short URL

Raises :

YourlsKeywordError

Indices and tables

Table Of Contents

This Page