You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/config-options.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
##Configuration options
1
+
# Configuration options
2
2
3
3
The kernel gateway adheres to the [Jupyter common configuration approach](https://jupyter.readthedocs.io/en/latest/projects/config.html). You can configure an instance of the kernel gateway using:
Once installed, you can use the `jupyter` CLI to run the server as shown above.
31
31
32
-
###Using a docker-stacks image
32
+
## Using a docker-stacks image
33
33
34
34
You can add the kernel gateway to any [docker-stacks](https://github.com/jupyter/docker-stacks) image by writing a Dockerfile patterned after the following example:
Copy file name to clipboardExpand all lines: docs/source/http-mode.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
##`notebook-http` Mode
1
+
# `notebook-http` Mode
2
2
3
3
The `KernelGatewayApp.api` command line argument can be set to `kernel_gateway.notebook_http`. This mode, or *personality*, has the kernel gateway expose annotated cells in the `KernelGatewayApp.seed_uri` notebook as HTTP resources.
4
4
@@ -21,7 +21,7 @@ print("I'm cell #1")
21
21
print("I'm cell #2")
22
22
```
23
23
24
-
###Getting the Request Data
24
+
## Getting the Request Data
25
25
26
26
Before the gateway invokes an annotated cell, it sets the value of a global notebook variable named `REQUEST` to a JSON string containing information about the request. You may parse this string to access the request properties.
27
27
@@ -46,7 +46,7 @@ The `REQUEST` object currently contains the following properties:
46
46
*`path` - An object of key-value pairs representing path parameters and their values.
47
47
*`headers` - An object of key-value pairs where a key is a HTTP header name and a value is the HTTP header value. If there are multiple values are specified for a header, the value will be an array.
48
48
49
-
####Request Content-Type and Request Body Processing
49
+
### Request Content-Type and Request Body Processing
50
50
51
51
If the HTTP request to the kernel gateway has a `Content-Type` header the value of `REQUEST.body` may change. Below is the list of outcomes for various mime-types:
52
52
@@ -55,7 +55,7 @@ If the HTTP request to the kernel gateway has a `Content-Type` header the value
55
55
*`text/plain` - The `REQUEST.body` will be the string value of the body
56
56
* All other types will be sent as strings
57
57
58
-
###Setting the Response Body
58
+
## Setting the Response Body
59
59
60
60
The response from an annotated cell may be set in one of two ways:
61
61
@@ -70,7 +70,7 @@ In both cases, the response defaults to status `200 OK` and `Content-Type: text/
70
70
71
71
See the [api_intro.ipynb](https://github.com/jupyter/kernel_gateway/blob/master/etc/api_examples/api_intro.ipynb) notebook for basic request and response examples.
72
72
73
-
###Setting the Response Status and Headers
73
+
## Setting the Response Status and Headers
74
74
75
75
Annotated cells may have an optional metadata companion cell that sets the HTTP response status and headers. Consider this Python cell that creates a person entry in a database table and returns the new row ID in a JSON object:
See the [setting_response_metadata.ipynb](https://github.com/jupyter/kernel_gateway/blob/master/etc/api_examples/setting_response_metadata.ipynb) notebook for examples of setting response metadata.
109
109
110
-
###Swagger Spec
110
+
## Swagger Spec
111
111
112
112
The resource `/_api/spec/swagger.json` is automatically generated from the notebook used to define the HTTP API. The response is a simple Swagger spec which can be used with the [Swagger editor](http://editor.swagger.io/#), a [Swagger ui](https://github.com/swagger-api/swagger-ui), or with any other Swagger-aware tool.
113
113
114
114
Currently, every response is listed as having a status of `200 OK`.
115
115
116
-
###Running
116
+
## Running
117
117
118
118
The minimum number of arguments needed to run in HTTP mode are `--KernelGatewayApp.api=kernel_gateway.notebook_http` and `--KernelGatewayApp.seed_uri=some/notebook/file.ipynb`.
Copy file name to clipboardExpand all lines: docs/source/plug-in.md
+2-3Lines changed: 2 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
##Developing New Modes
1
+
# Developing New Modes
2
2
3
3
The `KernelGatewayApp.api` can be set to the name of any module in the Python path supplying a personality. This allows for alternate kernel communications mechanisms.
[kernel_gateway.jupyter_websocket](_modules/kernel_gateway/jupyter_websocket.html) and [kernel_gateway.notebook_http](_modules/kernel_gateway/notebook_http.html).
39
+
Provided personalities include [kernel_gateway.jupyter_websocket](websocket-mode.md) and [kernel_gateway.notebook_http](http-mode.md).
###I can't access kernel gateway in my Docker container.
3
+
## I can't access kernel gateway in my Docker container.
4
4
5
5
The kernel gateway server listens on port 8888 by default. Make sure this internal port is exposed on an external port when starting the container. For example, if you run:
you can access your kernel gateway on the IP address of your Docker host an port 9000.
12
12
13
-
###Kernel gateway raises an error when I use `notebook-http` mode.
13
+
## Kernel gateway raises an error when I use `notebook-http` mode.
14
14
15
15
The `notebook-http` mode publishes a web API defined by annotations and code in a notebook. Make sure you are specifying a path or URL of a notebook (`*.ipynb`) file when you launch the kernel gateway in this mode. Set the `--KernelGatewayApp.seed_uri` command line parameter or `KG_SEED_URI` environment variable to do so.
0 commit comments