Skip to main content

handling of Mozilla XUL app profiles

Project description

is a python tool for creating and managing profiles for Mozilla's
applications (Firefox, Thunderbird, etc.). In addition to creating profiles,
mozprofile can install [addons](
and set
Mozprofile can be utilized from the command line or as an API.

# Command Line Usage

mozprofile may be used to create profiles, set preferences in
profiles, or install addons into profiles.

The profile to be operated on may be specified with the `--profile`
switch. If a profile is not specified, one will be created in a
temporary directory which will be echoed to the terminal:

(mozmill)> mozprofile
(mozmill)> ls /tmp/tmp4q1iEU.mozrunner

To run mozprofile from the command line enter:
`mozprofile --help` for a list of options.

# API Usage

To use mozprofile as an API you can import
and/or the

`mozprofile.profile` features a generic `Profile` class. In addition,
subclasses `FirefoxProfile` and `ThundebirdProfile` are available
with preset preferences for those applications.


def __init__(self,
profile=None, # Path to the profile
addons=None, # String of one or list of addons to install
addon_manifests=None, # Manifest for addons, see
preferences=None, # Dictionary or class of preferences
locations=None, # locations to proxy
proxy=False, # setup a proxy
restore=True # If true remove all installed addons preferences when cleaning up

def reset(self):
"""reset the profile to the beginning state"""

def set_preferences(self, preferences, filename='user.js'):
"""Adds preferences dict to profile preferences"""

def clean_preferences(self):
"""Removed preferences added by mozrunner."""

def cleanup(self):
"""Cleanup operations for the profile."""


def __init__(self, profile):
"""profile - the path to the profile for which we install addons"""

def install_addons(self, addons=None, manifests=None):
Installs all types of addons
addons - a list of addon paths to install
manifest - a list of addon manifests to install

def get_amo_install_path(self, query):
Return the addon xpi install path for the specified AMO query.
for query documentation.

def addon_details(cls, addon_path):
returns a dictionary of details about the addon
- addon_path : path to the addon directory
{'id': u'', # id of the addon
'version': u'1.4', # version of the addon
'name': u'Rainbow', # name of the addon
'unpack': False } # whether to unpack the addon

def clean_addons(self):
"""Cleans up addons in the profile."""

# Installing Addons

Addons may be installed individually or from a manifest.


from mozprofile import FirefoxProfile

# create new profile to pass to mozmill/mozrunner
profile = FirefoxProfile(addons=["adblock.xpi"])

# Setting Preferences

Preferences can be set in several ways:

- using the API: You can pass preferences in to the Profile class's
constructor: `obj = FirefoxProfile(preferences=[("accessibility.typeaheadfind.flashBar", 0)])`
- using a JSON blob file: `mozprofile --preferences myprefs.json`
- using a `.ini` file: `mozprofile --preferences myprefs.ini`
- via the command line: `mozprofile --pref key:value --pref key:value [...]`

When setting preferences from an `.ini` file or the `--pref` switch,
the value will be interpolated as an integer or a boolean
(`true`/`false`) if possible.

# Setting Permissions

mozprofile also takes care of adding permissions to the profile.

# Resources

Other Mozilla programs offer additional and overlapping functionality
for profiles. There is also substantive documentation on profiles and
their management.

- [ProfileManager]( :
XULRunner application for managing profiles. Has a GUI and CLI.
- [python-profilemanager]( : python CLI interface similar to ProfileManager
- profile documentation :

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for mozprofile, version 0.3.1
Filename, size File type Python version Upload date Hashes
Filename, size mozprofile-0.3.1.tar.gz (14.0 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page