ipyton magic tool to send HTTP requests in a cell of notebooks
Project description
# Jest
Jest is a IPython magic tool to make us one or more HTTP request(s) in a cell.
## How it works
```
$ pip install jest
```
## Examples
Please take a look at the `examples` folder about how Jest can be used in a Jupyter notebook in more detail. The snippets below represent a sequence of three cells each of which shows how we can construct a jest call along with required fields for two HTTP calls in one run.
```
[1] consumes = [
dict(original_keyword='iphone'),
dict(original_keyword='phone')
]
```
The `consumes` variable holds a list of dictionary. Two different items will be used while jesting a request with a request body.
```
[2] %%jest --var responses --params consumes
{
"url": "http://localhost:8080/path",
"request": "post",
"body": {
"field": "@original_keyword",
"field": 1
},
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer ASDASADAS",
"Cookie": "auth_cookie=ASDADASDA"
}
}
```
Jest saves the response in to the `responses` field. We use `--params` to add that Jest will use it to load data from. The request body references a field name with suffix `@`. So that Jest understands that the referenced field must be in each item of `consumes`.
```
len(responses) # 2 for each item of `consumes`
```
After having a successful request, we can react the result via `responses`.
## License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyjest-0.0.1.tar.gz
(4.8 kB
view details)
Built Distribution
File details
Details for the file pyjest-0.0.1.tar.gz
.
File metadata
- Download URL: pyjest-0.0.1.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 92c49d87f145ef6d523c4caeb8666bfaa5778492b91c3ab3347563dbc62c5b35 |
|
MD5 | ac1d37733bc604d3c64a7a138953493f |
|
BLAKE2b-256 | af4ad84f5f559db1f669924c15d6b2a2027a7ee32ec718ac12b8eaff54256d4b |
File details
Details for the file pyjest-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: pyjest-0.0.1-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59f2d93c1fc39f4f7aab702be47664f42e5d028f72448460910d7ec675220082 |
|
MD5 | e309d273b4357a8bc3a42d6f68a45fbf |
|
BLAKE2b-256 | fda1e586ce3f7e89966eb8ad7ac07ad3e951b45df6efc3562a535cbbaa06f1ce |