The Keychain parser was based on Python-Keyring by Jason R. Many of the cooler ideas in alfred-workflow-tddschn were inspired by Alfred2-Ruby-Template by Zhaocai. The documentation was generated using Sphinx and a modified version of the Alabaster theme by bitprophet. The code and the documentation are released under the MIT and Creative Commons Attribution-NonCommercial Licenses respectively. The documentation is also available as a Dash docset. ![]() The full documentation, including API docs and a tutorial, can be found at. save_password ( 'name of account', 'password1lolz' ) ![]() cached_data ( 'example', get_web_data, max_age = 30 ) for datum in data : wf. loads ( data ) def main ( wf ): # Save data from `get_web_data` for 30 seconds under # the key ``example`` data = wf. run ( main ))Ĭache data for 30 seconds: def get_web_data (): import json from urllib import request with request. send_feedback () if _name_ = '_main_' : # Create a global `Workflow3` object wf = Workflow3 () # Call your entry function via `n()` to enable its # helper functions, like exception catching, ARGV normalization, # magic arguments etc. ![]() # Well, you *can* call it multiple times, but subsequent calls # are ignored (otherwise the JSON sent to Alfred would be invalid). add_item ( u 'Item title', u 'Item subtitle' ) # Send output to Alfred. # This is also necessary for "magic" arguments to work. # Your imports go here if you want to catch import errors, which # is not a bad idea, or if the modules/packages are in a directory # added via `Workflow3(libraries=.)` import somemodule import anothermodule # Get args from Workflow3, already in normalized Unicode. # Not super useful, as the `wf` object created in # the `if _name_. from workflow import Workflow3 def main ( wf ): # The Workflow3 instance will be passed to the function # you call from `n`. The `Workflow` class # is also compatible with Alfred 2. Set up your workflow scripts as follows (if you wish to use the built-in error handling or sys.path modification): #!/usr/bin/python # encoding: utf-8 import sys # Workflow3 supports Alfred 3's new features. Your workflow should look something like this: Your Workflow/Īlternatively, you can clone/download the alfred-workflow-tddschn repository and copy the workflow subdirectory to your workflow's root directory.Ī few examples of how to use alfred-workflow-tddschn.
0 Comments
Leave a Reply. |