Jupyterpost: Jupyterhub service for posting to Mattermost.
Project description
Jupyterpost: post from Jupyterhub to a Mattermost server
Installing
pip install jupyterpost
Enabling jupyterpost
- Create a bot user on your Mattermost server and get its token.
- Add the following at the end of your Jupyterhub config file.
from jupyterpost import configure_jupyterhub
configure_jupyterhub(
c,
mattermost_token="your mattermost token",
mattermost_url="https://your.mattermost.server/api/v4/",
mattermost_team="your mattermost team name",
jupyterpost_url="https://services.your.jupyterhub/services/jupyterpost",
)
This will:
- add a new service
jupyterpost
to your Jupyterhub - give all users and their servers access to this service
- provide the service URL to the user's server as an environment variable
JUPYTERPOST_URL
The function is somewhat fragile, but should work for standard Jupyterhub installations.
Using jupyterpost
from jupyterpost import post
from matplotlib import pyplot
pyplot.plot([0, 1])
post(
message="Check out my plot",
channel="my-channel", # Or "@username"
attachment=pyplot.gcf(), # Or png bytes
)
Posting from outside of your Jupyterhub
- Get the variables
JUPYTERPOST_URL
andJPY_API_TOKEN
from your Jupyterhub server. - Provide them to
jupyterpost.post
as additional arguments and connect from anywhere!
Contributing
Contributions are welcome! Please open an issue or a pull request.
Specifically I would like to support more chat services, and more ways to post messages.
Tests would also be great huehuehue.
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
jupyterpost-0.0.1.tar.gz
(5.3 kB
view hashes)
Built Distribution
Close
Hashes for jupyterpost-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a99ca45e700cb2f41c3185cb6278b48265a58412422f4c6f0ab1921a15cd846 |
|
MD5 | 53b195b8cbf412631c9a6038d562d36e |
|
BLAKE2b-256 | 0d3b1363b68920fad4bca49b8d52369c7af4a3844eaaa56c962d3f64999e6412 |