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 details)
Built Distribution
File details
Details for the file jupyterpost-0.0.1.tar.gz
.
File metadata
- Download URL: jupyterpost-0.0.1.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.28.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f24f5278b071b30bbf7201612d1e08edae7bef7a049ea68d70ec36573397f37f |
|
MD5 | 1f8258dc7e580eba2b92d1183e564707 |
|
BLAKE2b-256 | cb80d3d089c4e78b1a5acc35a40b67c1d9d072308bb75fd2a657aebdc03991f6 |
File details
Details for the file jupyterpost-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: jupyterpost-0.0.1-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.28.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a99ca45e700cb2f41c3185cb6278b48265a58412422f4c6f0ab1921a15cd846 |
|
MD5 | 53b195b8cbf412631c9a6038d562d36e |
|
BLAKE2b-256 | 0d3b1363b68920fad4bca49b8d52369c7af4a3844eaaa56c962d3f64999e6412 |