API Reference

media_nommer_api

Import this client module from within your Python application or script to use media-nommer. Note that this API requires feederd to be running and reachable by the host that your Python application is on.

media_nommer_api.connect(api_hostname)[source]

Returns an APIConnection object, which is what you make API calls through. This is lazily loaded, so connect away without worry of overhead from instantiation alone. You shouldn’t take much of a performance hit until you actually perform some API calls.

Parameters:api_hostname (str) – A URL with protocol, hostname, and port. No trailing slash.
Returns:An APIConnection object, which has methods on it that map to feederd’s RESTful API.

media_nommer_api.api

This is the top-level API module. You should generally instantiate the APIConnection object in here by using media_nommer_api.connect() instead of direct initialization of APIConnection.

The APIConnection class is your link to feederd, which runs a JSON API.

class media_nommer_api.api.APIConnection(api_hostname)[source]

Your application’s means of communicating with feederd’s JSON API. The public methods on this class correspond to API calls.

API calls return APIResponse objects with the results of your queries. Check the APIResponse.data attrib for your un-serialized results.

Tip

Do not instantiate this class directly. Use the media_nommer_api.connect() function for that purpose.

Variables:api_hostname (str) – The protocol, hostname, and port in URI format.

This should generally only be called by media_nommer.client.connect().

Do any setup work to prepare this object for communication with feederd’s API. This method constructor should be as lazy as possible.

Parameters:api_hostname (str) – A URL with protocol, hostname, and port. No trailing slash.
job_submit(source_path, dest_path, job_options, notify_url=None)[source]

Submits an encoding job to feederd. This is an async call, so you may want to specify a notify_url for job state notifications to be sent to.

Parameters:
  • source_path (str) – The path string to the master file to encode.
  • dest_path (str) – The path string to where you’d like the encoded files to be saved to.
  • preset (str) – A preset string that corresponds to key in the settings.PRESETS dict.
  • job_options (dict) – A dictionary with additional job options like bitrates, target encoding formats, etc. These options can vary based on the Nommer and the formats you’re asking for.
  • notify_url (str) – (Optional) A URL to send job state updates to.
Returns:

An APIResponse object containing feederd‘s response.

media_nommer_api.server_io

API request and response abstraction and helpers. This module and its contents should not be instantiated directly.

class media_nommer_api.server_io.APIRequest(api_hostname, request_path, data)[source]

An abstraction class that all outbound API requests to feederd are wrapped in. Handles some basic serialization and transport stuff.

Variables:
  • data (dict) – The dict to be urlencoded and sent to the API server.
  • api_hostname (str) – The protocol, hostname, and port in URI format.
  • request_path (str) – The URL path to the API method.
Parameters:
  • api_hostname (str) – The protocol, hostname, and port of your feederd’s REST API. There should be no trailing slash.
  • request_path (str) – The URL to query. No leading or trailing slash.
  • data (dict) – A dict object of key/value pairs to urlencode and send to feederd’s REST API. If some of your POST keys require JSON values, you’ll need to serialize in your API method.
class media_nommer_api.server_io.APIResponse(request, raw_response)[source]

A basic API response. Performs some simple error handling and provides helpers to check the response for success or failure.

Your application will be interested in this class’s data instance variable, which contains the server’s response.

Variables:
  • data (dict) – The un-serialized response from feederd in dict form.
  • request (APIRequest) – The APIRequest object that this object originated from.
  • raw_response (str) – The raw, serialized string returned from feederd.
Parameters:
  • request (APIRequest) – The request object that instantiated this response object.
  • raw_response (str) – The raw server response’s body.
is_success()[source]

Indicates whether the call completed without errors.

Returns:True if there were no errors, False otherwise.
Return type:bool

Table Of Contents

Previous topic

Encoding Presets

This Page