-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 5192468
Showing
48 changed files
with
7,297 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Sphinx build info version 1 | ||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. | ||
config: 7b6d15ea29cbfe9c00587b91cc29979b | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
<!DOCTYPE html> | ||
|
||
<html lang="en" data-content_root="../"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Overview: module code — sxapi 0.0.post1.dev1+g088c1a1 documentation</title> | ||
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=fa44fd50" /> | ||
<link rel="stylesheet" type="text/css" href="../_static/alabaster.css?v=233b9934" /> | ||
<script src="../_static/documentation_options.js?v=2bb9f497"></script> | ||
<script src="../_static/doctools.js?v=888ff710"></script> | ||
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script> | ||
<link rel="index" title="Index" href="../genindex.html" /> | ||
<link rel="search" title="Search" href="../search.html" /> | ||
|
||
<link rel="stylesheet" href="../_static/custom.css" type="text/css" /> | ||
|
||
|
||
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" /> | ||
|
||
</head><body> | ||
|
||
|
||
<div class="document"> | ||
<div class="documentwrapper"> | ||
<div class="bodywrapper"> | ||
|
||
|
||
<div class="body" role="main"> | ||
|
||
<h1>All modules for which code is available</h1> | ||
<ul><li><a href="sxapi/base.html">sxapi.base</a></li> | ||
<li><a href="sxapi/cli/cli.html">sxapi.cli.cli</a></li> | ||
<li><a href="sxapi/cli/credentials.html">sxapi.cli.credentials</a></li> | ||
<li><a href="sxapi/cli/subparser/get_sensor_data.html">sxapi.cli.subparser.get_sensor_data</a></li> | ||
<li><a href="sxapi/cli/subparser/token.html">sxapi.cli.subparser.token</a></li> | ||
<li><a href="sxapi/publicV2/sensordata.html">sxapi.publicV2.sensordata</a></li> | ||
</ul> | ||
|
||
</div> | ||
|
||
</div> | ||
</div> | ||
<div class="sphinxsidebar" role="navigation" aria-label="main navigation"> | ||
<div class="sphinxsidebarwrapper"> | ||
<h1 class="logo"><a href="../index.html">sxapi</a></h1> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<h3>Navigation</h3> | ||
<ul> | ||
<li class="toctree-l1"><a class="reference internal" href="../readme.html">Overview</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../contributing.html">Contributions & Help</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../license.html">License</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../authors.html">Authors</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../changelog.html">Changelog</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../api/modules.html">Module Reference</a></li> | ||
</ul> | ||
|
||
<div class="relations"> | ||
<h3>Related Topics</h3> | ||
<ul> | ||
<li><a href="../index.html">Documentation overview</a><ul> | ||
</ul></li> | ||
</ul> | ||
</div> | ||
<div id="searchbox" style="display: none" role="search"> | ||
<h3 id="searchlabel">Quick search</h3> | ||
<div class="searchformwrapper"> | ||
<form class="search" action="../search.html" method="get"> | ||
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/> | ||
<input type="submit" value="Go" /> | ||
</form> | ||
</div> | ||
</div> | ||
<script>document.getElementById('searchbox').style.display = "block"</script> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
</div> | ||
</div> | ||
<div class="clearer"></div> | ||
</div> | ||
<div class="footer"> | ||
©2021, Florian Klien. | ||
|
||
| | ||
Powered by <a href="http://sphinx-doc.org/">Sphinx 7.2.5</a> | ||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.13</a> | ||
|
||
</div> | ||
|
||
|
||
|
||
|
||
</body> | ||
</html> |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,198 @@ | ||
<!DOCTYPE html> | ||
|
||
<html lang="en" data-content_root="../../../"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>sxapi.cli.credentials — sxapi 0.0.post1.dev1+g088c1a1 documentation</title> | ||
<link rel="stylesheet" type="text/css" href="../../../_static/pygments.css?v=fa44fd50" /> | ||
<link rel="stylesheet" type="text/css" href="../../../_static/alabaster.css?v=233b9934" /> | ||
<script src="../../../_static/documentation_options.js?v=2bb9f497"></script> | ||
<script src="../../../_static/doctools.js?v=888ff710"></script> | ||
<script src="../../../_static/sphinx_highlight.js?v=dc90522c"></script> | ||
<link rel="index" title="Index" href="../../../genindex.html" /> | ||
<link rel="search" title="Search" href="../../../search.html" /> | ||
|
||
<link rel="stylesheet" href="../../../_static/custom.css" type="text/css" /> | ||
|
||
|
||
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" /> | ||
|
||
</head><body> | ||
|
||
|
||
<div class="document"> | ||
<div class="documentwrapper"> | ||
<div class="bodywrapper"> | ||
|
||
|
||
<div class="body" role="main"> | ||
|
||
<h1>Source code for sxapi.cli.credentials</h1><div class="highlight"><pre> | ||
<span></span><span class="kn">import</span> <span class="nn">os</span> | ||
|
||
<span class="kn">import</span> <span class="nn">keyring</span> | ||
|
||
|
||
<div class="viewcode-block" id="UserCredentials"> | ||
<a class="viewcode-back" href="../../../api/sxapi.cli.html#sxapi.cli.credentials.UserCredentials">[docs]</a> | ||
<span class="k">class</span> <span class="nc">UserCredentials</span><span class="p">:</span> | ||
<span class="w"> </span><span class="sd">"""</span> | ||
<span class="sd"> Credentials class used for initializing, storing, retrieving and deleting</span> | ||
<span class="sd"> credentials.</span> | ||
|
||
<span class="sd"> This class should only be used in the cli_tests package.</span> | ||
<span class="sd"> """</span> | ||
|
||
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> | ||
<span class="w"> </span><span class="sd">"""</span> | ||
<span class="sd"> Basic User Credentials Constructor</span> | ||
|
||
<span class="sd"> calls self._init_creds() to set available credentials on startup.</span> | ||
<span class="sd"> """</span> | ||
|
||
<span class="bp">self</span><span class="o">.</span><span class="n">token_env_names</span> <span class="o">=</span> <span class="s2">"SMAXTEC_TOKEN"</span> | ||
<span class="bp">self</span><span class="o">.</span><span class="n">token</span> <span class="o">=</span> <span class="kc">None</span> | ||
|
||
<span class="bp">self</span><span class="o">.</span><span class="n">_init_creds</span><span class="p">()</span> | ||
|
||
<div class="viewcode-block" id="UserCredentials.get_token_environment"> | ||
<a class="viewcode-back" href="../../../api/sxapi.cli.html#sxapi.cli.credentials.UserCredentials.get_token_environment">[docs]</a> | ||
<span class="k">def</span> <span class="nf">get_token_environment</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> | ||
<span class="w"> </span><span class="sd">"""</span> | ||
<span class="sd"> Gets token named 'SMAXTEC_TOKEN' from the systems environment.</span> | ||
<span class="sd"> """</span> | ||
|
||
<span class="k">return</span> <span class="n">os</span><span class="o">.</span><span class="n">environ</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"SMAXTEC_TOKEN"</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span></div> | ||
|
||
|
||
<div class="viewcode-block" id="UserCredentials.set_token_keyring"> | ||
<a class="viewcode-back" href="../../../api/sxapi.cli.html#sxapi.cli.credentials.UserCredentials.set_token_keyring">[docs]</a> | ||
<span class="k">def</span> <span class="nf">set_token_keyring</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">token</span><span class="p">):</span> | ||
<span class="w"> </span><span class="sd">"""</span> | ||
<span class="sd"> Store the given token in keyring.</span> | ||
<span class="sd"> """</span> | ||
<span class="n">keyring</span><span class="o">.</span><span class="n">set_password</span><span class="p">(</span><span class="s2">"sxapi"</span><span class="p">,</span> <span class="s2">"SMAXTEC_TOKEN"</span><span class="p">,</span> <span class="n">token</span><span class="p">)</span> | ||
<span class="bp">self</span><span class="o">.</span><span class="n">token</span> <span class="o">=</span> <span class="n">token</span></div> | ||
|
||
|
||
<div class="viewcode-block" id="UserCredentials.get_token_keyring"> | ||
<a class="viewcode-back" href="../../../api/sxapi.cli.html#sxapi.cli.credentials.UserCredentials.get_token_keyring">[docs]</a> | ||
<span class="k">def</span> <span class="nf">get_token_keyring</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> | ||
<span class="w"> </span><span class="sd">"""</span> | ||
<span class="sd"> Gets the token stored in the keyring.</span> | ||
<span class="sd"> """</span> | ||
<span class="k">return</span> <span class="n">keyring</span><span class="o">.</span><span class="n">get_password</span><span class="p">(</span><span class="s2">"sxapi"</span><span class="p">,</span> <span class="s2">"SMAXTEC_TOKEN"</span><span class="p">)</span></div> | ||
|
||
|
||
<div class="viewcode-block" id="UserCredentials.clear_token_keyring"> | ||
<a class="viewcode-back" href="../../../api/sxapi.cli.html#sxapi.cli.credentials.UserCredentials.clear_token_keyring">[docs]</a> | ||
<span class="k">def</span> <span class="nf">clear_token_keyring</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> | ||
<span class="w"> </span><span class="sd">"""</span> | ||
<span class="sd"> Deletes the token from the keyring.</span> | ||
<span class="sd"> """</span> | ||
<span class="n">keyring</span><span class="o">.</span><span class="n">delete_password</span><span class="p">(</span><span class="s2">"sxapi"</span><span class="p">,</span> <span class="s2">"SMAXTEC_TOKEN"</span><span class="p">)</span></div> | ||
|
||
|
||
<span class="c1"># general functions</span> | ||
<div class="viewcode-block" id="UserCredentials.check_credentials_set"> | ||
<a class="viewcode-back" href="../../../api/sxapi.cli.html#sxapi.cli.credentials.UserCredentials.check_credentials_set">[docs]</a> | ||
<span class="k">def</span> <span class="nf">check_credentials_set</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> | ||
<span class="w"> </span><span class="sd">"""</span> | ||
<span class="sd"> Checks if token is already set.</span> | ||
<span class="sd"> """</span> | ||
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">token</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> | ||
<span class="k">return</span> <span class="kc">True</span> | ||
<span class="k">return</span> <span class="kc">False</span></div> | ||
|
||
|
||
<span class="k">def</span> <span class="nf">_init_creds</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> | ||
<span class="w"> </span><span class="sd">"""</span> | ||
<span class="sd"> This function tries to get the token from the system environment and</span> | ||
<span class="sd"> stores it in self.token, on failure (no token found) it does the same</span> | ||
<span class="sd"> with the keyring.</span> | ||
|
||
<span class="sd"> If both sources fail self.token remains None.</span> | ||
<span class="sd"> """</span> | ||
<span class="n">env_token</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_token_environment</span><span class="p">()</span> | ||
<span class="k">if</span> <span class="n">env_token</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> | ||
<span class="bp">self</span><span class="o">.</span><span class="n">token</span> <span class="o">=</span> <span class="n">env_token</span> | ||
<span class="k">return</span> | ||
|
||
<span class="n">keyring_token</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_token_keyring</span><span class="p">()</span> | ||
<span class="k">if</span> <span class="n">keyring_token</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> | ||
<span class="bp">self</span><span class="o">.</span><span class="n">token</span> <span class="o">=</span> <span class="n">keyring_token</span> | ||
<span class="k">return</span></div> | ||
|
||
</pre></div> | ||
|
||
</div> | ||
|
||
</div> | ||
</div> | ||
<div class="sphinxsidebar" role="navigation" aria-label="main navigation"> | ||
<div class="sphinxsidebarwrapper"> | ||
<h1 class="logo"><a href="../../../index.html">sxapi</a></h1> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<h3>Navigation</h3> | ||
<ul> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../readme.html">Overview</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../contributing.html">Contributions & Help</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../license.html">License</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../authors.html">Authors</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../changelog.html">Changelog</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../api/modules.html">Module Reference</a></li> | ||
</ul> | ||
|
||
<div class="relations"> | ||
<h3>Related Topics</h3> | ||
<ul> | ||
<li><a href="../../../index.html">Documentation overview</a><ul> | ||
<li><a href="../../index.html">Module code</a><ul> | ||
</ul></li> | ||
</ul></li> | ||
</ul> | ||
</div> | ||
<div id="searchbox" style="display: none" role="search"> | ||
<h3 id="searchlabel">Quick search</h3> | ||
<div class="searchformwrapper"> | ||
<form class="search" action="../../../search.html" method="get"> | ||
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/> | ||
<input type="submit" value="Go" /> | ||
</form> | ||
</div> | ||
</div> | ||
<script>document.getElementById('searchbox').style.display = "block"</script> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
</div> | ||
</div> | ||
<div class="clearer"></div> | ||
</div> | ||
<div class="footer"> | ||
©2021, Florian Klien. | ||
|
||
| | ||
Powered by <a href="http://sphinx-doc.org/">Sphinx 7.2.5</a> | ||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.13</a> | ||
|
||
</div> | ||
|
||
|
||
|
||
|
||
</body> | ||
</html> |
Oops, something went wrong.