Python client for Hypernova, https://github.com/airbnb/hypernova
Project description
# hypernova-python [](https://travis-ci.org/ornj/hypernova-python)
> A Python client for the Hypernova service
## Getting Started
Install the python client from pypi
```sh
pip install hypernova-python
```
Once you have the client installed and an instance of the Hypernova service running, you can making requests is easy.
### Example
```python
import hypernova
renderer = hypernova.Renderer('http://localhost')
html = renderer.render({'MyComponent.js': {'name': 'Foo'}})
```
## Configuration
You can pass configuration options to `Renderer` at initialization.
* `url`: The address of the Hypernova service is listening, including port if necessary
* `plugins`: A list of plugins to use
* `timeout`: Number of seconds to wait for a response from the Hypernova service
* `headers`: Dictionary of HTTP headers to override the default. You will want to include `'Content-Type': 'application/json'`
## Plugins
You can implement custom events and alter requests through the [Plugin Lifecycle](https://github.com/airbnb/hypernova-node/blob/master/README.md#plugin-lifecycle-api). All lifecycle methods are optional.
### Example
```python
import hypernova
import random
class MyPlugin(object):
def prepare_request(self, current_jobs, original_jobs):
job = current_jobs.get('MyComponent.js')
job.update({'random_int_for_reasons': random.randint(0, 100))
return current_jobs
renderer = hypernova.Renderer('http://localhost', [MyPlugin()])
```
> A Python client for the Hypernova service
## Getting Started
Install the python client from pypi
```sh
pip install hypernova-python
```
Once you have the client installed and an instance of the Hypernova service running, you can making requests is easy.
### Example
```python
import hypernova
renderer = hypernova.Renderer('http://localhost')
html = renderer.render({'MyComponent.js': {'name': 'Foo'}})
```
## Configuration
You can pass configuration options to `Renderer` at initialization.
* `url`: The address of the Hypernova service is listening, including port if necessary
* `plugins`: A list of plugins to use
* `timeout`: Number of seconds to wait for a response from the Hypernova service
* `headers`: Dictionary of HTTP headers to override the default. You will want to include `'Content-Type': 'application/json'`
## Plugins
You can implement custom events and alter requests through the [Plugin Lifecycle](https://github.com/airbnb/hypernova-node/blob/master/README.md#plugin-lifecycle-api). All lifecycle methods are optional.
### Example
```python
import hypernova
import random
class MyPlugin(object):
def prepare_request(self, current_jobs, original_jobs):
job = current_jobs.get('MyComponent.js')
job.update({'random_int_for_reasons': random.randint(0, 100))
return current_jobs
renderer = hypernova.Renderer('http://localhost', [MyPlugin()])
```
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
hypernova-0.0.3.tar.gz
(4.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hypernova-0.0.3.tar.gz.
File metadata
- Download URL: hypernova-0.0.3.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b721777f86e7bc664a600b9460b1d233635ce3c0dc05bcc7391f8db26aba2d4
|
|
| MD5 |
ef1636dcba38e63ae4353651152e41ce
|
|
| BLAKE2b-256 |
6a81be84db5e4d98594cf20a45f65ce4e8561d3fee5674f707533f1f825cdc06
|
File details
Details for the file hypernova-0.0.3-py3-none-any.whl.
File metadata
- Download URL: hypernova-0.0.3-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ae20189fbd5f51512ad819cf8c43a99fdb89a2e0fbdec96bfcce8e1ed2f069b
|
|
| MD5 |
130913a95a5805232943186b37948404
|
|
| BLAKE2b-256 |
6004ff8d11aae149e63707c8fec436e299ff758d691d65469f3ee5438017ee49
|