Fetching contributors…
Cannot retrieve contributors at this time
40 lines (28 sloc) 1008 Bytes


** Warning: This is an experimental api. It is not a final design, and could be modified in the future. **

Sometimes, you'll need to store a history of what happened previously, for caching or re-use purposes. In that case, there is a history dictionary available.

import requests

def main(build):
    if not build.history.get("script_downloaded", False):
        resp = requests.get("", stream=True)

        with open(os.path.join(build.root, "my_script"), "wb") as fh:
            for block in response.iter_content(1024):

        build.history["script_downloaded"] = True

The history can store any of the following primitives:

  • strings
  • integers
  • floats
  • boolean
  • lists of any storable type
  • a dictionary of string keys and any storable type

Full API Reference

.. autoclass:: uranium.history.History