Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #14 from DCSO/release/1.0.0-beta1
Browse files Browse the repository at this point in the history
Release v1.0.0-beta1
  • Loading branch information
Geert Vanderkelen authored Jan 15, 2021
2 parents 1bd45a6 + 4dfe924 commit c016bc1
Show file tree
Hide file tree
Showing 18 changed files with 241 additions and 45 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
DCSO Portal Python SDK
======================

Copyright (c) 2020, DCSO Deutsche Cyber-Sicherheitsorganisation GmbH
Copyright (c) 2020, 2021, DCSO Deutsche Cyber-Sicherheitsorganisation GmbH

DCSO Portal Python Software Development Kit (SDK) helps you create
application which need to interact with the DCSO Portal.

Documentation: [https://dcso.github.io/dcso-portal-python-sdk/dcso/portal/](https://dcso.github.io/dcso-portal-python-sdk/dcso/portal/)

Requirements
------------

This library is, when installed, pure Python. We use only 3rd party tools
for installation and documentation generation.

* Python v3.7 or greater
* Python v3.7 or greater (Python v3.6 as best effort)
* See requirements in `requirements.txt`

Requirements can be installed using, for example, `pip`:
Expand Down Expand Up @@ -47,13 +49,11 @@ Prerequisites in this document).
Documentation
-------------

Documentation is available as HTML in the `docs/html/dcso` folder.
Documentation is available as HTML in the `docs/dcso/portal` folder.

It is possible to generate it using:

$ ./gendocs.py

open ./docs/html/dcso/index.html

Alternatively, it is also possible to have the documentation service
by the pdoc3 web server. This is mostly useful for working on the
Expand Down
4 changes: 1 addition & 3 deletions docs/dcso/glosom/constants.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ <h1 class="title">Module <code>dcso.glosom.constants</code></h1>
</summary>
<pre><code class="python"># Copyright (c) 2020, DCSO GmbH

from typing import Final

GROUP_SYSTEM = 0x01
&#34;&#34;&#34;Constant defining GLOSOM System message group (0x01)&#34;&#34;&#34;

Expand Down Expand Up @@ -145,7 +143,7 @@ <h1>Index</h1>
<p>Copyright (c) 2020, <a href="https://dcso.de">DCSO Deutsche Cyber-Sicherheitsorganisation GmbH</a></p>
</div>
<div>
<p><strong>v0.9.0.dev1</strong></p>
<p><strong>v0.1.0-beta1</strong></p>
</div>
</div>
</footer>
Expand Down
8 changes: 7 additions & 1 deletion docs/dcso/glosom/glosom.html
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ <h1 class="title">Module <code>dcso.glosom.glosom</code></h1>

def __str__(self) -&gt; str:
if self.glosom.message_id == 0:
# try with non-GLOSOM
if self.glosom.message != &#34;&#34;:
return self.glosom.message
return &#34;invalid message&#34;
else:
return &#34;{msg} ({code:X})&#34;.format(msg=self.glosom.message, code=self.glosom.code)</code></pre>
Expand Down Expand Up @@ -384,6 +387,9 @@ <h3>Methods</h3>

def __str__(self) -&gt; str:
if self.glosom.message_id == 0:
# try with non-GLOSOM
if self.glosom.message != &#34;&#34;:
return self.glosom.message
return &#34;invalid message&#34;
else:
return &#34;{msg} ({code:X})&#34;.format(msg=self.glosom.message, code=self.glosom.code)</code></pre>
Expand Down Expand Up @@ -440,7 +446,7 @@ <h4><code><a title="dcso.glosom.glosom.GlosomException" href="#dcso.glosom.gloso
<p>Copyright (c) 2020, <a href="https://dcso.de">DCSO Deutsche Cyber-Sicherheitsorganisation GmbH</a></p>
</div>
<div>
<p><strong>v0.9.0.dev1</strong></p>
<p><strong>v0.1.0-beta1</strong></p>
</div>
</div>
</footer>
Expand Down
2 changes: 1 addition & 1 deletion docs/dcso/glosom/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ <h1>Index</h1>
<p>Copyright (c) 2020, <a href="https://dcso.de">DCSO Deutsche Cyber-Sicherheitsorganisation GmbH</a></p>
</div>
<div>
<p><strong>v0.9.0.dev1</strong></p>
<p><strong>v0.1.0-beta1</strong></p>
</div>
</div>
</footer>
Expand Down
2 changes: 1 addition & 1 deletion docs/dcso/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ <h1>Index</h1>
<p>Copyright (c) 2020, <a href="https://dcso.de">DCSO Deutsche Cyber-Sicherheitsorganisation GmbH</a></p>
</div>
<div>
<p><strong>v0.9.0.dev1</strong></p>
<p><strong>v0.1.0-beta1</strong></p>
</div>
</div>
</footer>
Expand Down
4 changes: 2 additions & 2 deletions docs/dcso/portal/abstracts.html
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ <h3>Instance variables</h3>
<h3>Methods</h3>
<dl>
<dt id="dcso.portal.abstracts.APIAbstract.execute_graphql"><code class="name flex">
<span>def <span class="ident">execute_graphql</span></span>(<span>self, query: str, variables: Union[dict, NoneType] = None, fragments: Union[List[str], NoneType] = None) ‑> <function namedtuple at 0x7f8cb80edaf0></span>
<span>def <span class="ident">execute_graphql</span></span>(<span>self, query: str, variables: Union[dict, NoneType] = None, fragments: Union[List[str], NoneType] = None) ‑> <function namedtuple at 0x7fa1a4c01830></span>
</code></dt>
<dd>
<div class="desc"></div>
Expand Down Expand Up @@ -245,7 +245,7 @@ <h4><code><a title="dcso.portal.abstracts.ServiceAbstract" href="#dcso.portal.ab
<p>Copyright (c) 2020, <a href="https://dcso.de">DCSO Deutsche Cyber-Sicherheitsorganisation GmbH</a></p>
</div>
<div>
<p><strong>v0.9.0.dev1</strong></p>
<p><strong>v0.1.0-beta1</strong></p>
</div>
</div>
</footer>
Expand Down
4 changes: 2 additions & 2 deletions docs/dcso/portal/api.html
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ <h3>Methods</h3>
</details>
</dd>
<dt id="dcso.portal.api.APIClient.execute_graphql"><code class="name flex">
<span>def <span class="ident">execute_graphql</span></span>(<span>self, query: str, variables: Union[dict, NoneType] = None, fragments: Union[List[str], NoneType] = None) ‑> <function namedtuple at 0x7f8cb80edaf0></span>
<span>def <span class="ident">execute_graphql</span></span>(<span>self, query: str, variables: Union[dict, NoneType] = None, fragments: Union[List[str], NoneType] = None) ‑> <function namedtuple at 0x7fa1a4c01830></span>
</code></dt>
<dd>
<div class="desc"><p>Executes the GraphQL query and returns response as namedtuple. This
Expand Down Expand Up @@ -596,7 +596,7 @@ <h4><code><a title="dcso.portal.api.APIClient" href="#dcso.portal.api.APIClient"
<p>Copyright (c) 2020, <a href="https://dcso.de">DCSO Deutsche Cyber-Sicherheitsorganisation GmbH</a></p>
</div>
<div>
<p><strong>v0.9.0.dev1</strong></p>
<p><strong>v0.1.0-beta1</strong></p>
</div>
</div>
</footer>
Expand Down
2 changes: 1 addition & 1 deletion docs/dcso/portal/auth/auth.html
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ <h4><code><a title="dcso.portal.auth.auth.Authentication" href="#dcso.portal.aut
<p>Copyright (c) 2020, <a href="https://dcso.de">DCSO Deutsche Cyber-Sicherheitsorganisation GmbH</a></p>
</div>
<div>
<p><strong>v0.9.0.dev1</strong></p>
<p><strong>v0.1.0-beta1</strong></p>
</div>
</div>
</footer>
Expand Down
2 changes: 1 addition & 1 deletion docs/dcso/portal/auth/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ <h1>Index</h1>
<p>Copyright (c) 2020, <a href="https://dcso.de">DCSO Deutsche Cyber-Sicherheitsorganisation GmbH</a></p>
</div>
<div>
<p><strong>v0.9.0.dev1</strong></p>
<p><strong>v0.1.0-beta1</strong></p>
</div>
</div>
</footer>
Expand Down
2 changes: 1 addition & 1 deletion docs/dcso/portal/auth/rbac.html
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ <h4><code><a title="dcso.portal.auth.rbac.ServicePermissions" href="#dcso.portal
<p>Copyright (c) 2020, <a href="https://dcso.de">DCSO Deutsche Cyber-Sicherheitsorganisation GmbH</a></p>
</div>
<div>
<p><strong>v0.9.0.dev1</strong></p>
<p><strong>v0.1.0-beta1</strong></p>
</div>
</div>
</footer>
Expand Down
2 changes: 1 addition & 1 deletion docs/dcso/portal/auth/token.html
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ <h4><code><a title="dcso.portal.auth.token.Token" href="#dcso.portal.auth.token.
<p>Copyright (c) 2020, <a href="https://dcso.de">DCSO Deutsche Cyber-Sicherheitsorganisation GmbH</a></p>
</div>
<div>
<p><strong>v0.9.0.dev1</strong></p>
<p><strong>v0.1.0-beta1</strong></p>
</div>
</div>
</footer>
Expand Down
2 changes: 1 addition & 1 deletion docs/dcso/portal/exceptions.html
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ <h4><code><a title="dcso.portal.exceptions.PortalException" href="#dcso.portal.e
<p>Copyright (c) 2020, <a href="https://dcso.de">DCSO Deutsche Cyber-Sicherheitsorganisation GmbH</a></p>
</div>
<div>
<p><strong>v0.9.0.dev1</strong></p>
<p><strong>v0.1.0-beta1</strong></p>
</div>
</div>
</footer>
Expand Down
2 changes: 1 addition & 1 deletion docs/dcso/portal/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ <h1>Index</h1>
<p>Copyright (c) 2020, <a href="https://dcso.de">DCSO Deutsche Cyber-Sicherheitsorganisation GmbH</a></p>
</div>
<div>
<p><strong>v0.9.0.dev1</strong></p>
<p><strong>v0.1.0-beta1</strong></p>
</div>
</div>
</footer>
Expand Down
45 changes: 30 additions & 15 deletions docs/dcso/portal/util/graphql.html
Original file line number Diff line number Diff line change
Expand Up @@ -154,17 +154,22 @@ <h1 class="title">Module <code>dcso.portal.util.graphql</code></h1>

try:
first_error = response[&#39;errors&#39;][0]
except (KeyError, IndexError):
except (TypeError, KeyError, IndexError):
# all is good; return response
return response

try:
err = first_error[&#39;message&#39;]
if &#39;extensions&#39; in first_error and &#39;detail&#39; in first_error[&#39;extensions&#39;]:
err += &#39; (&#39; + first_error[&#39;extensions&#39;][&#39;detail&#39;] + &#39;)&#39;
g = Glosom(message=first_error[&#39;message&#39;], code=first_error[&#39;extensions&#39;][&#39;code&#39;])
code = &#34;&#34;
if &#39;extensions&#39; in first_error:
if &#39;detail&#39; in first_error[&#39;extensions&#39;]:
err += &#39; (&#39; + first_error[&#39;extensions&#39;][&#39;detail&#39;] + &#39;)&#39;
code = first_error[&#39;extensions&#39;].get(&#39;code&#39;, &#34;&#34;)
g = Glosom(message=first_error[&#39;message&#39;], code=code)
except KeyError as exc:
raise PortalAPIRequest(f&#34;API request contained unusable error definition {exc}&#34;)
except AttributeError:
raise PortalAPIRequest(f&#34;API request contained unusable error extensions&#34;)
else:
raise PortalAPIError(glosom=g)

Expand Down Expand Up @@ -209,7 +214,7 @@ <h1 class="title">Module <code>dcso.portal.util.graphql</code></h1>
<h2 class="section-title" id="header-functions">Functions</h2>
<dl>
<dt id="dcso.portal.util.graphql.graphql_data_to_namedtuple"><code class="name flex">
<span>def <span class="ident">graphql_data_to_namedtuple</span></span>(<span>mapping: dict, name: str = 'data') ‑> <function namedtuple at 0x7f8cb80edaf0></span>
<span>def <span class="ident">graphql_data_to_namedtuple</span></span>(<span>mapping: dict, name: str = 'data') ‑> <function namedtuple at 0x7fa1a4c01830></span>
</code></dt>
<dd>
<div class="desc"><p>Transforms GraphQL response data and returns it as a namedtuple.</p>
Expand Down Expand Up @@ -590,17 +595,22 @@ <h3>Methods</h3>

try:
first_error = response[&#39;errors&#39;][0]
except (KeyError, IndexError):
except (TypeError, KeyError, IndexError):
# all is good; return response
return response

try:
err = first_error[&#39;message&#39;]
if &#39;extensions&#39; in first_error and &#39;detail&#39; in first_error[&#39;extensions&#39;]:
err += &#39; (&#39; + first_error[&#39;extensions&#39;][&#39;detail&#39;] + &#39;)&#39;
g = Glosom(message=first_error[&#39;message&#39;], code=first_error[&#39;extensions&#39;][&#39;code&#39;])
code = &#34;&#34;
if &#39;extensions&#39; in first_error:
if &#39;detail&#39; in first_error[&#39;extensions&#39;]:
err += &#39; (&#39; + first_error[&#39;extensions&#39;][&#39;detail&#39;] + &#39;)&#39;
code = first_error[&#39;extensions&#39;].get(&#39;code&#39;, &#34;&#34;)
g = Glosom(message=first_error[&#39;message&#39;], code=code)
except KeyError as exc:
raise PortalAPIRequest(f&#34;API request contained unusable error definition {exc}&#34;)
except AttributeError:
raise PortalAPIRequest(f&#34;API request contained unusable error extensions&#34;)
else:
raise PortalAPIError(glosom=g)

Expand All @@ -619,7 +629,7 @@ <h3>Methods</h3>
<h3>Methods</h3>
<dl>
<dt id="dcso.portal.util.graphql.GraphQLRequest.execute"><code class="name flex">
<span>def <span class="ident">execute</span></span>(<span>self) ‑> <function namedtuple at 0x7f8cb80edaf0></span>
<span>def <span class="ident">execute</span></span>(<span>self) ‑> <function namedtuple at 0x7fa1a4c01830></span>
</code></dt>
<dd>
<div class="desc"><p>Executes the GraphQL request returning response as a namedtuple.</p>
Expand Down Expand Up @@ -675,17 +685,22 @@ <h3>Methods</h3>

try:
first_error = response[&#39;errors&#39;][0]
except (KeyError, IndexError):
except (TypeError, KeyError, IndexError):
# all is good; return response
return response

try:
err = first_error[&#39;message&#39;]
if &#39;extensions&#39; in first_error and &#39;detail&#39; in first_error[&#39;extensions&#39;]:
err += &#39; (&#39; + first_error[&#39;extensions&#39;][&#39;detail&#39;] + &#39;)&#39;
g = Glosom(message=first_error[&#39;message&#39;], code=first_error[&#39;extensions&#39;][&#39;code&#39;])
code = &#34;&#34;
if &#39;extensions&#39; in first_error:
if &#39;detail&#39; in first_error[&#39;extensions&#39;]:
err += &#39; (&#39; + first_error[&#39;extensions&#39;][&#39;detail&#39;] + &#39;)&#39;
code = first_error[&#39;extensions&#39;].get(&#39;code&#39;, &#34;&#34;)
g = Glosom(message=first_error[&#39;message&#39;], code=code)
except KeyError as exc:
raise PortalAPIRequest(f&#34;API request contained unusable error definition {exc}&#34;)
except AttributeError:
raise PortalAPIRequest(f&#34;API request contained unusable error extensions&#34;)
else:
raise PortalAPIError(glosom=g)</code></pre>
</details>
Expand Down Expand Up @@ -820,7 +835,7 @@ <h4><code><a title="dcso.portal.util.graphql.GraphQLRequest" href="#dcso.portal.
<p>Copyright (c) 2020, <a href="https://dcso.de">DCSO Deutsche Cyber-Sicherheitsorganisation GmbH</a></p>
</div>
<div>
<p><strong>v0.9.0.dev1</strong></p>
<p><strong>v0.1.0-beta1</strong></p>
</div>
</div>
</footer>
Expand Down
2 changes: 1 addition & 1 deletion docs/dcso/portal/util/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ <h1>Index</h1>
<p>Copyright (c) 2020, <a href="https://dcso.de">DCSO Deutsche Cyber-Sicherheitsorganisation GmbH</a></p>
</div>
<div>
<p><strong>v0.9.0.dev1</strong></p>
<p><strong>v0.1.0-beta1</strong></p>
</div>
</div>
</footer>
Expand Down
2 changes: 1 addition & 1 deletion docs/dcso/portal/util/networking.html
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ <h1>Index</h1>
<p>Copyright (c) 2020, <a href="https://dcso.de">DCSO Deutsche Cyber-Sicherheitsorganisation GmbH</a></p>
</div>
<div>
<p><strong>v0.9.0.dev1</strong></p>
<p><strong>v0.1.0-beta1</strong></p>
</div>
</div>
</footer>
Expand Down
Loading

0 comments on commit c016bc1

Please sign in to comment.