Skip to content

Commit

Permalink
bump version to 11.0b11 (#530)
Browse files Browse the repository at this point in the history
* bump version to 11.0b11

* generate docs
  • Loading branch information
abom authored Jan 3, 2021
1 parent 8012769 commit 797fe42
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 3 deletions.
101 changes: 99 additions & 2 deletions docs/api/jumpscale/servers/gedis_http/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,16 @@ <h1 class="title">Module <code>jumpscale.servers.gedis_http</code></h1>
class GedisHTTPServer(Base):
host = fields.String(default=&#34;127.0.0.1&#34;)
port = fields.Integer(default=8000)
allow_cors = fields.Boolean(default=True)

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._app = Bottle()
self._client = None
self._app.route(&#34;/&lt;package&gt;/&lt;actor&gt;/&lt;method&gt;&#34;, [&#34;GET&#34;, &#34;POST&#34;], self.handler)
http_methods = [&#34;GET&#34;, &#34;POST&#34;]
if self.allow_cors:
http_methods.extend([&#34;OPTIONS&#34;, &#34;PUT&#34;, &#34;DELETE&#34;])
self._app.route(&#34;/&lt;package&gt;/&lt;actor&gt;/&lt;method&gt;&#34;, http_methods, self.enable_cors(self.handler, self.allow_cors))

@property
def client(self):
Expand All @@ -54,6 +58,24 @@ <h1 class="title">Module <code>jumpscale.servers.gedis_http</code></h1>
response.content_type = &#34;application/json&#34;
return json.dumps(content)

def enable_cors(self, fn, allow_cors=True):
def _enable_cors(*args, **kwargs):
# set CORS headers
response.headers[&#34;Access-Control-Allow-Origin&#34;] = &#34;*&#34;
response.headers[&#34;Access-Control-Allow-Methods&#34;] = &#34;GET, POST, PUT, OPTIONS, DELETE&#34;
response.headers[
&#34;Access-Control-Allow-Headers&#34;
] = &#34;Origin, Accept, Content-Type, X-Requested-With, X-CSRF-Token&#34;

if request.method != &#34;OPTIONS&#34;:
# actual request; reply with the actual response
return fn(*args, **kwargs)

if allow_cors:
return _enable_cors
else:
return fn

def handler(self, package, actor, method):
actors = self.client.actors

Expand Down Expand Up @@ -145,12 +167,16 @@ <h2 id="args">Args</h2>
<pre><code class="python">class GedisHTTPServer(Base):
host = fields.String(default=&#34;127.0.0.1&#34;)
port = fields.Integer(default=8000)
allow_cors = fields.Boolean(default=True)

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._app = Bottle()
self._client = None
self._app.route(&#34;/&lt;package&gt;/&lt;actor&gt;/&lt;method&gt;&#34;, [&#34;GET&#34;, &#34;POST&#34;], self.handler)
http_methods = [&#34;GET&#34;, &#34;POST&#34;]
if self.allow_cors:
http_methods.extend([&#34;OPTIONS&#34;, &#34;PUT&#34;, &#34;DELETE&#34;])
self._app.route(&#34;/&lt;package&gt;/&lt;actor&gt;/&lt;method&gt;&#34;, http_methods, self.enable_cors(self.handler, self.allow_cors))

@property
def client(self):
Expand All @@ -164,6 +190,24 @@ <h2 id="args">Args</h2>
response.content_type = &#34;application/json&#34;
return json.dumps(content)

def enable_cors(self, fn, allow_cors=True):
def _enable_cors(*args, **kwargs):
# set CORS headers
response.headers[&#34;Access-Control-Allow-Origin&#34;] = &#34;*&#34;
response.headers[&#34;Access-Control-Allow-Methods&#34;] = &#34;GET, POST, PUT, OPTIONS, DELETE&#34;
response.headers[
&#34;Access-Control-Allow-Headers&#34;
] = &#34;Origin, Accept, Content-Type, X-Requested-With, X-CSRF-Token&#34;

if request.method != &#34;OPTIONS&#34;:
# actual request; reply with the actual response
return fn(*args, **kwargs)

if allow_cors:
return _enable_cors
else:
return fn

def handler(self, package, actor, method):
actors = self.client.actors

Expand Down Expand Up @@ -204,6 +248,31 @@ <h3>Ancestors</h3>
</ul>
<h3>Instance variables</h3>
<dl>
<dt id="jumpscale.servers.gedis_http.GedisHTTPServer.allow_cors"><code class="name">var <span class="ident">allow_cors</span></code></dt>
<dd>
<section class="desc"><p>getter method this property</p>
<p>will call <code>_get_value</code>, which would if the value is already defined
and will get the default value if not</p>
<h2 id="returns">Returns</h2>
<dl>
<dt><strong><code>any</code></strong></dt>
<dd>the field value</dd>
</dl></section>
<details class="source">
<summary>Source code</summary>
<pre><code class="python">def getter(self):
&#34;&#34;&#34;
getter method this property

will call `_get_value`, which would if the value is already defined
and will get the default value if not

Returns:
any: the field value
&#34;&#34;&#34;
return self._get_value(name, field)</code></pre>
</details>
</dd>
<dt id="jumpscale.servers.gedis_http.GedisHTTPServer.client"><code class="name">var <span class="ident">client</span></code></dt>
<dd>
<section class="desc"></section>
Expand Down Expand Up @@ -280,6 +349,32 @@ <h2 id="returns">Returns</h2>
</dl>
<h3>Methods</h3>
<dl>
<dt id="jumpscale.servers.gedis_http.GedisHTTPServer.enable_cors"><code class="name flex">
<span>def <span class="ident">enable_cors</span></span>(<span>self, fn, allow_cors=True)</span>
</code></dt>
<dd>
<section class="desc"></section>
<details class="source">
<summary>Source code</summary>
<pre><code class="python">def enable_cors(self, fn, allow_cors=True):
def _enable_cors(*args, **kwargs):
# set CORS headers
response.headers[&#34;Access-Control-Allow-Origin&#34;] = &#34;*&#34;
response.headers[&#34;Access-Control-Allow-Methods&#34;] = &#34;GET, POST, PUT, OPTIONS, DELETE&#34;
response.headers[
&#34;Access-Control-Allow-Headers&#34;
] = &#34;Origin, Accept, Content-Type, X-Requested-With, X-CSRF-Token&#34;

if request.method != &#34;OPTIONS&#34;:
# actual request; reply with the actual response
return fn(*args, **kwargs)

if allow_cors:
return _enable_cors
else:
return fn</code></pre>
</details>
</dd>
<dt id="jumpscale.servers.gedis_http.GedisHTTPServer.handler"><code class="name flex">
<span>def <span class="ident">handler</span></span>(<span>self, package, actor, method)</span>
</code></dt>
Expand Down Expand Up @@ -366,7 +461,9 @@ <h1>Index</h1>
<li>
<h4><code><a title="jumpscale.servers.gedis_http.GedisHTTPServer" href="#jumpscale.servers.gedis_http.GedisHTTPServer">GedisHTTPServer</a></code></h4>
<ul class="two-column">
<li><code><a title="jumpscale.servers.gedis_http.GedisHTTPServer.allow_cors" href="#jumpscale.servers.gedis_http.GedisHTTPServer.allow_cors">allow_cors</a></code></li>
<li><code><a title="jumpscale.servers.gedis_http.GedisHTTPServer.client" href="#jumpscale.servers.gedis_http.GedisHTTPServer.client">client</a></code></li>
<li><code><a title="jumpscale.servers.gedis_http.GedisHTTPServer.enable_cors" href="#jumpscale.servers.gedis_http.GedisHTTPServer.enable_cors">enable_cors</a></code></li>
<li><code><a title="jumpscale.servers.gedis_http.GedisHTTPServer.gevent_server" href="#jumpscale.servers.gedis_http.GedisHTTPServer.gevent_server">gevent_server</a></code></li>
<li><code><a title="jumpscale.servers.gedis_http.GedisHTTPServer.handler" href="#jumpscale.servers.gedis_http.GedisHTTPServer.handler">handler</a></code></li>
<li><code><a title="jumpscale.servers.gedis_http.GedisHTTPServer.host" href="#jumpscale.servers.gedis_http.GedisHTTPServer.host">host</a></code></li>
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tool.poetry]
name = "js-ng"
packages = [{ include = "jumpscale" }]
version = "11.0b10"
version = "11.0b11"
description = "system automation, configuration management and RPC framework"
authors = ["xmonader <xmonader@gmail.com>"]
license = "MIT"
Expand Down

0 comments on commit 797fe42

Please sign in to comment.