Giter VIP home page Giter VIP logo

telepyth's Introduction

TelePyth

Telegram notification with IPython magics.

Overview

TelePyth (named /teləˈpaɪθ/) — a Telegram bot that is integrated with IPython. It provides an ability to send any text notification to user from Jupyter notebook or IPython CLI.

Bot Commands

Start chat with @telepyth_bot and get access token using /start command. TelePyth Bot understands some other simple commands. Type

  • /start to begin interaction with bot;
  • /revoke to revoke token issued before;
  • /last to get current valid token or nothing if there is no active one;
  • /help to see help message and credentials.

Usage

TelePyth command is available as an IPython magic command which could be used in Jupyter notebook as well as in plain IPython, qtconsole etc. TelePyth package could be also used directly in Python. And also, there is an HTTP API through which all the things works.

IPython Magics

It is easy to send messages after token is issued. Just install telepyth package by pip install telepyth, import it and notify

    import telepyth

    %telepyth -t 123456789
    %telepyth 'Very magic, wow!'

TelePyth Client

TelepythClient allows to send notifications, figures and markdown messages directly without using magics.

    from telepyth import TelepythClient

    tp = TelepythClient()
    tp.send_text('Hello, World!')  # notify with plain text
    tp.send_text('_bold text_ and then *italic*')  # or with markdown formatted text
    tp.send_figure(some_pyplot_figure, 'Awesome caption here!')  # or even with figure

CLI

TelePyth package also provide command line interface (CLI). It is similar to IPython magic. For example, one can send notifcation as following.

    telepyth -t 31415926 "Moar notifications!"

HTTP API

Note that you can use TelePyth to send notifications via Telegram without any wrappers and bindings. This is useful for bash scripting. Just request TelePyth backend directly to notify user. For instance, to send message from bash:

    curl https://daskol.xyz/api/notify/<access_token_here> \
        -X POST \
        -H 'Content-Type: plain/text' \
        -d 'Hello, World!'

See more examples and usage details here.

Credentials

© Daniel Bershatsky <[email protected]>, 2017

telepyth's People

Contributors

daskol avatar maremun avatar ei-grad avatar

Watchers

Val Kharitonov avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.