<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Version — Stem 1.1.0 documentation</title> <link rel="stylesheet" href="../_static/haiku.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> <link rel="stylesheet" href="../_static/print.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../', VERSION: '1.1.0', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="../_static/jquery.js"></script> <script type="text/javascript" src="../_static/underscore.js"></script> <script type="text/javascript" src="../_static/doctools.js"></script> <script type="text/javascript" src="../_static/theme_extras.js"></script> <link rel="shortcut icon" href="../_static/favicon.png"/> <link rel="top" title="Stem 1.1.0 documentation" href="../index.html" /> <link rel="up" title="Contents" href="../contents.html" /> <link rel="next" title="Descriptor" href="descriptor/descriptor.html" /> <link rel="prev" title="Exit Policy" href="exit_policy.html" /> </head> <body> <div class="header"><img class="rightlogo" src="../_static/logo.png" alt="Logo"/><h1 class="heading"><a href="../index.html"> <span>Stem Docs</span></a></h1> <h2 class="heading"><span>Version</span></h2> </div> <div class="topnav"> <p> <ul id="navbar"> <li><a href="../index.html">Home</a></li> <li><a href="../tutorials.html">Tutorials</a> <ul> <li><a href="../tutorials/the_little_relay_that_could.html">Hello World</a></li> <li><a href="../tutorials/to_russia_with_love.html">Client Usage</a></li> <li><a href="../tutorials/tortoise_and_the_hare.html">Event Listening</a></li> <li><a href="../tutorials/mirror_mirror_on_the_wall.html">Tor Descriptors</a></li> <li><a href="../tutorials/east_of_the_sun.html">Utilities</a></li> <li><a href="../tutorials/double_double_toil_and_trouble.html">Examples</a></li> </ul> </li> <li><a href="../api.html">API</a> <ul> <li><a href="control.html">stem.control</a></li> <li><a href="connection.html">stem.connection</a></li> <li><a href="socket.html">stem.socket</a></li> <li><a href="process.html">stem.process</a></li> <li><a href="response.html">stem.response</a></li> <li><a href="exit_policy.html">stem.exit_policy</a></li> <li><a href="#">stem.version</a></li> <li><a href="../api.html#descriptors">Descriptors</a></li> <li><a href="../api.html#utilities">Utilities</a></li> </ul> </li> <li><a href="https://trac.torproject.org/projects/tor/wiki/doc/stem">Development</a> <ul> <li><a href="../faq.html">FAQ</a></li> <li><a href="../change_log.html">Change Log</a></li> <li><a href="https://trac.torproject.org/projects/tor/wiki/doc/stem/bugs">Bug Tracker</a></li> <li><a href="../download.html">Download</a></li> </ul> </li> </ul> </p> </div> <div class="content"> <div class="section" id="module-stem.version"> <span id="version"></span><h1>Version<a class="headerlink" href="#module-stem.version" title="Permalink to this headline">¶</a></h1> <p>Tor versioning information and requirements for its features. These can be easily parsed and compared, for instance...</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">stem.version</span> <span class="kn">import</span> <span class="n">get_system_tor_version</span><span class="p">,</span> <span class="n">Requirement</span> <span class="gp">>>> </span><span class="n">my_version</span> <span class="o">=</span> <span class="n">get_system_tor_version</span><span class="p">()</span> <span class="gp">>>> </span><span class="k">print</span> <span class="n">my_version</span> <span class="go">0.2.1.30</span> <span class="gp">>>> </span><span class="n">my_version</span> <span class="o">>=</span> <span class="n">Requirement</span><span class="o">.</span><span class="n">CONTROL_SOCKET</span> <span class="go">True</span> </pre></div> </div> <p><strong>Module Overview:</strong></p> <div class="highlight-python"><pre>get_system_tor_version - gets the version of our system's tor installation Version - Tor versioning information</pre> </div> <dl class="data"> <dt id="stem.version.Requirement"> <tt class="descclassname">stem.version.</tt><tt class="descname">Requirement</tt><big>(</big><em>enum</em><big>)</big><a class="headerlink" href="#stem.version.Requirement" title="Permalink to this definition">¶</a></dt> <dd><p>Enumerations for the version requirements of features.</p> <table border="1" class="docutils"> <colgroup> <col width="36%" /> <col width="64%" /> </colgroup> <thead valign="bottom"> <tr class="row-odd"><th class="head">Requirement</th> <th class="head">Description</th> </tr> </thead> <tbody valign="top"> <tr class="row-even"><td><strong>AUTH_SAFECOOKIE</strong></td> <td>SAFECOOKIE authentication method</td> </tr> <tr class="row-odd"><td><strong>EVENT_AUTHDIR_NEWDESCS</strong></td> <td>AUTHDIR_NEWDESC events</td> </tr> <tr class="row-even"><td><strong>EVENT_BUILDTIMEOUT_SET</strong></td> <td>BUILDTIMEOUT_SET events</td> </tr> <tr class="row-odd"><td><strong>EVENT_CIRC_MINOR</strong></td> <td>CIRC_MINOR events</td> </tr> <tr class="row-even"><td><strong>EVENT_CLIENTS_SEEN</strong></td> <td>CLIENTS_SEEN events</td> </tr> <tr class="row-odd"><td><strong>EVENT_CONF_CHANGED</strong></td> <td>CONF_CHANGED events</td> </tr> <tr class="row-even"><td><strong>EVENT_DESCCHANGED</strong></td> <td>DESCCHANGED events</td> </tr> <tr class="row-odd"><td><strong>EVENT_GUARD</strong></td> <td>GUARD events</td> </tr> <tr class="row-even"><td><strong>EVENT_NEWCONSENSUS</strong></td> <td>NEWCONSENSUS events</td> </tr> <tr class="row-odd"><td><strong>EVENT_NS</strong></td> <td>NS events</td> </tr> <tr class="row-even"><td><strong>EVENT_SIGNAL</strong></td> <td>SIGNAL events</td> </tr> <tr class="row-odd"><td><strong>EVENT_STATUS</strong></td> <td>STATUS_GENERAL, STATUS_CLIENT, and STATUS_SERVER events</td> </tr> <tr class="row-even"><td><strong>EVENT_STREAM_BW</strong></td> <td>STREAM_BW events</td> </tr> <tr class="row-odd"><td><strong>EVENT_TRANSPORT_LAUNCHED</strong></td> <td>TRANSPORT_LAUNCHED events</td> </tr> <tr class="row-even"><td><strong>EXTENDCIRCUIT_PATH_OPTIONAL</strong></td> <td>EXTENDCIRCUIT queries can omit the path if the circuit is zero</td> </tr> <tr class="row-odd"><td><strong>FEATURE_EXTENDED_EVENTS</strong></td> <td>‘EXTENDED_EVENTS’ optional feature</td> </tr> <tr class="row-even"><td><strong>FEATURE_VERBOSE_NAMES</strong></td> <td>‘VERBOSE_NAMES’ optional feature</td> </tr> <tr class="row-odd"><td><strong>GETINFO_CONFIG_TEXT</strong></td> <td>‘GETINFO config-text’ query</td> </tr> <tr class="row-even"><td><strong>LOADCONF</strong></td> <td>LOADCONF requests</td> </tr> <tr class="row-odd"><td><strong>MICRODESCRIPTOR_IS_DEFAULT</strong></td> <td>Tor gets microdescriptors by default rather than server descriptors</td> </tr> <tr class="row-even"><td><strong>TAKEOWNERSHIP</strong></td> <td>TAKEOWNERSHIP requests</td> </tr> <tr class="row-odd"><td><strong>TORRC_CONTROL_SOCKET</strong></td> <td>‘ControlSocket <path>’ config option</td> </tr> <tr class="row-even"><td><strong>TORRC_PORT_FORWARDING</strong></td> <td>‘PortForwarding’ config option</td> </tr> <tr class="row-odd"><td><strong>TORRC_DISABLE_DEBUGGER_ATTACHMENT</strong></td> <td>‘DisableDebuggerAttachment’ config option</td> </tr> </tbody> </table> </dd></dl> <dl class="function"> <dt id="stem.version.get_system_tor_version"> <tt class="descclassname">stem.version.</tt><tt class="descname">get_system_tor_version</tt><big>(</big><em>tor_cmd='tor'</em><big>)</big><a class="reference internal" href="../_modules/stem/version.html#get_system_tor_version"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#stem.version.get_system_tor_version" title="Permalink to this definition">¶</a></dt> <dd><p>Queries tor for its version. This is os dependent, only working on linux, osx, and bsd.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>tor_cmd</strong> (<em>str</em>) – command used to run tor</td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><a class="reference internal" href="#stem.version.Version" title="stem.version.Version"><tt class="xref py py-class docutils literal"><span class="pre">Version</span></tt></a> provided by the tor command</td> </tr> <tr class="field-odd field"><th class="field-name">Raises :</th><td class="field-body"><strong>IOError</strong> if unable to query or parse the version</td> </tr> </tbody> </table> </dd></dl> <dl class="class"> <dt id="stem.version.Version"> <em class="property">class </em><tt class="descclassname">stem.version.</tt><tt class="descname">Version</tt><big>(</big><em>version_str</em><big>)</big><a class="reference internal" href="../_modules/stem/version.html#Version"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#stem.version.Version" title="Permalink to this definition">¶</a></dt> <dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></p> <p>Comparable tor version. These are constructed from strings that conform to the ‘new’ style in the <a class="reference external" href="https://gitweb.torproject.org/torspec.git/blob/HEAD:/version-spec.txt">tor version-spec</a>, such as “0.1.4” or “0.2.2.23-alpha (git-7dcd105be34a4f44)”.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Variables:</th><td class="field-body"><ul class="first simple"> <li><strong>major</strong> (<em>int</em>) – major version</li> <li><strong>minor</strong> (<em>int</em>) – minor version</li> <li><strong>micro</strong> (<em>int</em>) – micro version</li> <li><strong>patch</strong> (<em>int</em>) – patch level (<strong>None</strong> if undefined)</li> <li><strong>status</strong> (<em>str</em>) – status tag such as ‘alpha’ or ‘beta-dev’ (<strong>None</strong> if undefined)</li> <li><strong>extra</strong> (<em>str</em>) – extra information without its parentheses such as ‘git-8be6058d8f31e578’ (<strong>None</strong> if undefined)</li> <li><strong>git_commit</strong> (<em>str</em>) – git commit id (<strong>None</strong> if it wasn’t provided)</li> </ul> </td> </tr> <tr class="field-even field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>version_str</strong> (<em>str</em>) – version to be parsed</p> </td> </tr> <tr class="field-odd field"><th class="field-name">Raises :</th><td class="field-body"><p class="first last"><strong>ValueError</strong> if input isn’t a valid tor version</p> </td> </tr> </tbody> </table> </dd></dl> </div> </div> <div class="bottomnav"> </div> <div class="footer"> </div> </body> </html>