Skip to main content
Help us improve Python packaging – donate today!

Alfred 2 Workflow python module

Project Description

# Alfred Python

A simple python module for alfred workflow。


* Easily get bundle id, query arguments
* Simple feedback XML generation
* Provides functions for storing or retrieving cache data
* Workflow configuration management
* Includes an easy way to download remote file

## installation

sudo easy_install python-alfred

## Code Example

>>> import alfred
>>> alfred.bundleID()
>>> alfred.log('log message') # save log message to 'log.txt' in workflow's folder
>>> alfred.exit('exit-message')
>>> alfred.exitWithFeedback(title='exitWithFeedback')
<items><item uid="net.jeeker.awf.AppDig.29008681"><icon>icon.png</icon><subtitle /><title>exitWithFeedback</title></item></items>

>>> feedback = alfred.Feedback()
>>> feedback.addItem(title='Feedback Title', subtitle='subtitle', autocomplete='subcmd', valid=False)
>>> feedback.addItem(title='Feedback Title 2', subtitle='subtitle 2', arg='arg')
>>> feedback.addItem(title='Feedback Title 3', subtitle='subtitle 3')
>>> feedback.output()
<items><item autocomplete="subcmd" uid="net.jeeker.awf.AppDig.11134445" valid="no"><icon>icon.png</icon><subtitle>subtitle</subtitle><title>Feedback Title</title></item><item arg="arg" uid="net.jeeker.awf.AppDig.20583908"><icon>icon.png</icon><subtitle>subtitle 2</subtitle><title>Feedback Title 2</title></item><item uid="net.jeeker.awf.AppDig.31032116"><icon>icon.png</icon><subtitle>subtitle 3</subtitle><title>Feedback Title 3</title></item></items>

>>> alfred.config.set(username='JinnLynn', testkey='testvalue')
>>> alfred.config.getAll()
{u'username': u'JinnLynn', u'testkey': u'testvalue'}
>>> alfred.config.get('username')
>>> alfred.config.delete('username')
>>> alfred.config.getAll()
{u'testkey': u'testvalue'}

>>> alfred.cache.set('test-cache', {'cache-data':'test-data'}, expire=10)
>>> alfred.cache.get('test-cache')
{u'cache-data': u'test-data'}
>>> alfred.cache.timeout('test-cache')
>>> alfred.cache.get('test-cache') # expired return None
>>> alfred.cache.timeout('test-cache')

>>>'') # Non-existent
>>>'', download=True)

## License
The MIT License

Release history Release notifications

This version
History Node


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
python-alfred-0.1.1.tar.gz (6.8 kB) Copy SHA256 hash SHA256 Source None Dec 9, 2013

Supported by

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