Skip to content

Commit

Permalink
Merge pull request #194 from uc-cdis/fix/types-missing-from-response
Browse files Browse the repository at this point in the history
Fix/types missing from response
  • Loading branch information
mfshao authored Aug 22, 2023
2 parents 36105c1 + 83814f1 commit fcef4ac
Show file tree
Hide file tree
Showing 56 changed files with 1,161 additions and 573 deletions.
327 changes: 234 additions & 93 deletions .secrets.baseline

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ jobs:
- python: 3.10
before_install:
- pip install --upgrade pip
- pip install poetry
# cannot update poetry to 1.6.x+ until we can update urllib3 >= 2.0.0, see https://github.com/orgs/python-poetry/discussions/8345
- pip install poetry==1.5.1
- which poetry
- poetry --version
install:
Expand Down
Binary file modified docs/_build/doctrees/auth.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/_build/doctrees/file.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/indexing.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/jobs.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/metadata.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/object.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/query.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/submission.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/tools.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/tools/drs_pull.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/tools/indexing.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/tools/metadata.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/wss.doctree
Binary file not shown.
33 changes: 24 additions & 9 deletions docs/_build/html/_modules/gen3/auth.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<!DOCTYPE html>

<html lang="en">
<html lang="en" data-content_root="../../">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>gen3.auth &#8212; Gen3 SDK documentation</title>
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=4f649999" />
<link rel="stylesheet" type="text/css" href="../../_static/alabaster.css?v=039e1c02" />
<script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js?v=b3ba4146"></script>
<script src="../../_static/documentation_options.js?v=5929fcd5"></script>
<script src="../../_static/doctools.js?v=888ff710"></script>
<script src="../../_static/sphinx_highlight.js?v=4825356b"></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" />

Expand Down Expand Up @@ -152,7 +152,9 @@ <h1>Source code for gen3.auth</h1><div class="highlight"><pre>
<span class="k">return</span> <span class="n">cache_prefix</span> <span class="o">+</span> <span class="n">m</span><span class="o">.</span><span class="n">hexdigest</span><span class="p">()</span>


<div class="viewcode-block" id="Gen3Auth"><a class="viewcode-back" href="../../auth.html#gen3.auth.Gen3Auth">[docs]</a><span class="k">class</span> <span class="nc">Gen3Auth</span><span class="p">(</span><span class="n">AuthBase</span><span class="p">):</span>
<div class="viewcode-block" id="Gen3Auth">
<a class="viewcode-back" href="../../auth.html#gen3.auth.Gen3Auth">[docs]</a>
<span class="k">class</span> <span class="nc">Gen3Auth</span><span class="p">(</span><span class="n">AuthBase</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Gen3 auth helper class for use with requests auth.</span>

<span class="sd"> Implements requests.auth.AuthBase in order to support JWT authentication.</span>
Expand Down Expand Up @@ -386,7 +388,9 @@ <h1>Source code for gen3.auth</h1><div class="highlight"><pre>

<span class="k">return</span> <span class="n">_response</span>

<div class="viewcode-block" id="Gen3Auth.refresh_access_token"><a class="viewcode-back" href="../../auth.html#gen3.auth.Gen3Auth.refresh_access_token">[docs]</a> <span class="k">def</span> <span class="nf">refresh_access_token</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">endpoint</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<div class="viewcode-block" id="Gen3Auth.refresh_access_token">
<a class="viewcode-back" href="../../auth.html#gen3.auth.Gen3Auth.refresh_access_token">[docs]</a>
<span class="k">def</span> <span class="nf">refresh_access_token</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">endpoint</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Get a new access token&quot;&quot;&quot;</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_use_wts</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_access_token</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_access_token_from_wts</span><span class="p">(</span><span class="n">endpoint</span><span class="p">)</span>
Expand Down Expand Up @@ -415,6 +419,7 @@ <h1>Source code for gen3.auth</h1><div class="highlight"><pre>

<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_access_token</span></div>


<span class="nd">@backoff</span><span class="o">.</span><span class="n">on_exception</span><span class="p">(</span>
<span class="n">wait_gen</span><span class="o">=</span><span class="n">backoff</span><span class="o">.</span><span class="n">expo</span><span class="p">,</span> <span class="n">exception</span><span class="o">=</span><span class="ne">Exception</span><span class="p">,</span> <span class="o">**</span><span class="n">DEFAULT_BACKOFF_SETTINGS</span>
<span class="p">)</span>
Expand All @@ -434,7 +439,9 @@ <h1>Source code for gen3.auth</h1><div class="highlight"><pre>
<span class="n">logging</span><span class="o">.</span><span class="n">warning</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
<span class="k">raise</span> <span class="n">e</span>

<div class="viewcode-block" id="Gen3Auth.get_access_token"><a class="viewcode-back" href="../../auth.html#gen3.auth.Gen3Auth.get_access_token">[docs]</a> <span class="k">def</span> <span class="nf">get_access_token</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<div class="viewcode-block" id="Gen3Auth.get_access_token">
<a class="viewcode-back" href="../../auth.html#gen3.auth.Gen3Auth.get_access_token">[docs]</a>
<span class="k">def</span> <span class="nf">get_access_token</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Get the access token - auto refresh if within 5 minutes of expiration&quot;&quot;&quot;</span>
<span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_access_token</span><span class="p">:</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_use_wts</span> <span class="o">==</span> <span class="kc">True</span><span class="p">:</span>
Expand Down Expand Up @@ -467,6 +474,7 @@ <h1>Source code for gen3.auth</h1><div class="highlight"><pre>
<span class="c1"># use cache</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_access_token</span></div>


<span class="k">def</span> <span class="nf">_get_auth_value</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Returns the Authorization header value for the request</span>

Expand All @@ -476,7 +484,9 @@ <h1>Source code for gen3.auth</h1><div class="highlight"><pre>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">return</span> <span class="s2">&quot;bearer &quot;</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_access_token</span><span class="p">()</span>

<div class="viewcode-block" id="Gen3Auth.curl"><a class="viewcode-back" href="../../auth.html#gen3.auth.Gen3Auth.curl">[docs]</a> <span class="k">def</span> <span class="nf">curl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">path</span><span class="p">,</span> <span class="n">request</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<div class="viewcode-block" id="Gen3Auth.curl">
<a class="viewcode-back" href="../../auth.html#gen3.auth.Gen3Auth.curl">[docs]</a>
<span class="k">def</span> <span class="nf">curl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">path</span><span class="p">,</span> <span class="n">request</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Curl the given endpoint - ex: gen3 curl /user/user. Return requests.Response</span>

Expand Down Expand Up @@ -508,7 +518,10 @@ <h1>Source code for gen3.auth</h1><div class="highlight"><pre>
<span class="k">raise</span> <span class="ne">Exception</span><span class="p">(</span><span class="s2">&quot;Invalid request type: &quot;</span> <span class="o">+</span> <span class="n">request</span><span class="p">)</span>
<span class="k">return</span> <span class="n">output</span></div>

<div class="viewcode-block" id="Gen3Auth.get_access_token_from_wts"><a class="viewcode-back" href="../../auth.html#gen3.auth.Gen3Auth.get_access_token_from_wts">[docs]</a> <span class="k">def</span> <span class="nf">get_access_token_from_wts</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">endpoint</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>

<div class="viewcode-block" id="Gen3Auth.get_access_token_from_wts">
<a class="viewcode-back" href="../../auth.html#gen3.auth.Gen3Auth.get_access_token_from_wts">[docs]</a>
<span class="k">def</span> <span class="nf">get_access_token_from_wts</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">endpoint</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Try to fetch an access token for the given idp from the wts</span>
<span class="sd"> in the given namespace. If idp is not set, then default to &quot;local&quot;</span>
Expand Down Expand Up @@ -651,7 +664,9 @@ <h1>Source code for gen3.auth</h1><div class="highlight"><pre>
<span class="n">err_msg</span> <span class="o">=</span> <span class="s2">&quot;Please make sure the target commons is connected on your profile page and that connection has not expired.&quot;</span>
<span class="k">if</span> <span class="n">resp</span><span class="o">.</span><span class="n">status_code</span> <span class="o">!=</span> <span class="mi">200</span><span class="p">:</span>
<span class="n">logging</span><span class="o">.</span><span class="n">warning</span><span class="p">(</span><span class="n">err_msg</span><span class="p">)</span>
<span class="k">return</span> <span class="n">_handle_access_token_response</span><span class="p">(</span><span class="n">resp</span><span class="p">,</span> <span class="s2">&quot;token&quot;</span><span class="p">)</span></div></div>
<span class="k">return</span> <span class="n">_handle_access_token_response</span><span class="p">(</span><span class="n">resp</span><span class="p">,</span> <span class="s2">&quot;token&quot;</span><span class="p">)</span></div>
</div>

</pre></div>

</div>
Expand Down
Loading

0 comments on commit fcef4ac

Please sign in to comment.