-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.html
139 lines (98 loc) · 5.43 KB
/
utils.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<!DOCTYPE html>
<html lang="en" data-content_root="./">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>All-purpose utility functions — Spireblight documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=d1102ebc" />
<link rel="stylesheet" type="text/css" href="_static/basic.css?v=686e5160" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.css?v=27fed22d" />
<script src="_static/documentation_options.js?v=5929fcd5"></script>
<script src="_static/doctools.js?v=9bcbadda"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<link rel="icon" href="_static/favicon.ico"/>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="prev" title="Parsing run history and savegame data" href="fileparser.html" />
<link rel="stylesheet" href="_static/custom.css" type="text/css" />
</head><body>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="module-utils">
<span id="all-purpose-utility-functions"></span><h1>All-purpose utility functions<a class="headerlink" href="#module-utils" title="Link to this heading">¶</a></h1>
<dl class="py function">
<dt class="sig sig-object py" id="utils.get_req_data">
<em class="property"><span class="k"><span class="pre">async</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">utils.</span></span><span class="sig-name descname"><span class="pre">get_req_data</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">req</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">keys</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#utils.get_req_data" title="Link to this definition">¶</a></dt>
<dd><p>Validate POST requests and extract data.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type<span class="colon">:</span></dt>
<dd class="field-odd"><p>list[str]</p>
</dd>
<dt class="field-even">Parameters<span class="colon">:</span></dt>
<dd class="field-even"><ul class="simple">
<li><p><strong>req</strong> (<em>aiohttp.web.Request</em>) – The incoming POST request.</p></li>
<li><p><strong>keys</strong> (<em>str</em>) – The keys to extract from the request.</p></li>
</ul>
</dd>
</dl>
<p>All valid POST requests must include a <cite>key</cite> key, which must be exactly
equal to the stored secret on the server. If it is not present, the client
will receive an HTTP 401 “Unauthorized”. If it is present and does not match,
HTTP 403 “Forbidden” will be raised instead. If the server does not possess a
secret, an HTTP 501 “Not Implemented” will be raised.</p>
<p>The secret may not be URL-encoded. For a production environment, the use of
<cite>secrets.token_urlsafe</cite> is strongly recommended. The main instance uses a
secret with 64 random bits.</p>
<p>If the secret is present and matching, the values matching the provided keys
will be extracted, decoded, and returned in a list. No further parsing is
done on the data; it is the responsibility of the caller to do so.</p>
</dd></dl>
</section>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="Main">
<div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="index.html">Spireblight</a></h1>
<search id="searchbox" style="display: none" role="search">
<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" placeholder="Search"/>
<input type="submit" value="Go" />
</form>
</div>
</search>
<script>document.getElementById('searchbox').style.display = "block"</script><h3>Navigation</h3>
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="fileparser.html">Parsing run history and savegame data</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">All-purpose utility functions</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#utils.get_req_data"><code class="docutils literal notranslate"><span class="pre">get_req_data()</span></code></a></li>
</ul>
</li>
</ul>
<div class="relations">
<h3>Related Topics</h3>
<ul>
<li><a href="index.html">Documentation overview</a><ul>
<li>Previous: <a href="fileparser.html" title="previous chapter">Parsing run history and savegame data</a></li>
</ul></li>
</ul>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
©2022, Anilyka Barry, Olivia Thiderman, Spireblight Development Team.
|
Powered by <a href="https://www.sphinx-doc.org/">Sphinx 8.1.3</a>
& <a href="https://alabaster.readthedocs.io">Alabaster 1.0.0</a>
|
<a href="_sources/utils.rst.txt"
rel="nofollow">Page source</a>
</div>
</body>
</html>