Skip to main content

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 pyjest
```

## 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


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.2.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

pyjest-0.0.2-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file pyjest-0.0.2.tar.gz.

File metadata

  • Download URL: pyjest-0.0.2.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

Hashes for pyjest-0.0.2.tar.gz
Algorithm Hash digest
SHA256 2df7be300682bec618933b845c7df14e4ed2eff0b165e6d1625de279155f3d9a
MD5 8e9e3d60e2ff8636aba530be5953edc2
BLAKE2b-256 71a4194964cb7382505c1828577b544d1ac3780afd07277a6c745ab7a08cecf5

See more details on using hashes here.

File details

Details for the file pyjest-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: pyjest-0.0.2-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

Hashes for pyjest-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9a75ebb24f14a9f085d83517591d1d7588c0ea137b27d23bc77e362eb2d0268e
MD5 7412d94e55bfef2c436cb4e8b539ae31
BLAKE2b-256 d5efb6d506271f2017dd2ac443b91fa9e5eb30509efba21c89b30b9c36726878

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page