Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

Shirka

This a bot based on twisted, mostly a python learning project

Consumers

  • flowdock: read message from flow dock stream API

Responders

  • face

  • whois

  • math

  • wat

  • xkcd

  • ascii

  • 9gag

Installation

Install dependencies:

pip install twisted
pip install twistedhttpstream
pip install requests
pip install sympy
pip install mocker
pip install pyopenssl
pip install python-flowdock
pip install markdown
pip install paramiko
pip install pyyaml
pip install ioc

Running Tests

python tests.py # run all tests
python -m unittest responders.xkcd # run one test

Usage

  • start.py

# vim: set fileencoding=utf-8 :

import twistedhttpstream, yaml, sys, logging
from twisted.internet import reactor
import ioc

logging.basicConfig(level=logging.DEBUG)

container = ioc.build([
    'config.yml',
])

if __name__ == "__main__":

    for flow in container.parameters['consumers']:
        twistedhttpstream.stream(
            reactor,
            "https://stream.flowdock.com/flows/%s/%s" % (container.parameters["flowdock.%s.organisation" % flow], flow),
            container.get("consumer.%s.flowdock" % flow),
            username=container.parameters["flowdock.%s.user.token" % flow],
            password=""
        )


    reactor.run()
  • Configuration file

parameters:
    consumers: [test]
    bot.name: nono
    bot.email: no-reply@shirka.com

    remote.users: [XXX]
    remote.servers:
        # paramiko option - http://www.lag.net/paramiko/docs/paramiko.SSHClient-class.html
        nono: {host: XXXX, username: XXXX, look_for_keys: false, password: XXXX }

    # configure flow parameterstest
    flowdock.test.organisation: shirka
    flowdock.test.flow.name:    FLOW_NAME
    flowdock.test.flow.token:   FLOW_TOKEN
    flowdock.test.user.name:    rande
    flowdock.test.user.token:   USER_TOKEN


services:

    # Configure the bot
    bot:
        class: shirka.consumers.Bot
        arguments: [ '%bot.name%', '%bot.email%']

    # Configure shared responders
    responders.math:        { class: shirka.responders.MathResponder }
    responders.xkcd:        { class: shirka.responders.XkcdResponder }
    responders.big_bro:     { class: shirka.responders.BigbroResponder }
    responders.reminder:    { class: shirka.responders.ReminderResponder }
    responders.status:      { class: shirka.responders.StatusResponder }
    responders.rage_face:   { class: shirka.responders.RagefaceResponder }
    responders.wat:         { class: shirka.responders.WatResponder }
    responders.9gag:        { class: shirka.responders.NineGagResponder }

    responders.remote:
        class: shirka.responders.RemoteResponder
        arguments:
            - '%remote.servers%'
            - '%remote.users%'


    # Configure flowdock push API
    flowdock.test:
        class: flowdock.FlowDock
        kwargs:
            api_key:  '%flowdock.test.flow.token%'
            app_name: '%bot.name%'
            project:  Project test

    consumer.test.flowdock.logger:
        class: logging.getLogger
        arguments:
            - 'flowdock.%flowdock.test.flow.name%'

    # Configure Stream API Consumer with valid responders
    consumer.test.flowdock:
        class: shirka.consumers.FlowDockConsumer
        arguments:
            - '@bot'
            - "%flowdock.test.flow.token%"
            -
                - '@responders.rage_face'
                - '@responders.test.whois'
                - '@responders.math'
                - '@responders.big_bro'
                - '@responders.reminder'
                - '@responders.remote'
                - '@responders.status'
                - '@responders.test.help'
                - '@responders.test.whois'

            - '@flowdock.test'
        kwargs:
            logger: '@consumer.test.flowdock.logger'

    responders.test.whois:
        class: shirka.responders.FlowdockWhoisResponder
        arguments:
            - '%flowdock.test.organisation%'
            - '%flowdock.test.flow.name%'
            - '%flowdock.test.user.token%'

    responders.test.help:
        class: shirka.responders.HelpResponder

Metadata

Release files for shirka 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for shirka 0.0.3
File Size Uploaded Provenance Actions
shirka-0.0.3.tar.gz 571.9 kB Without provenance Details for shirka-0.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for shirka 0.0.3
File Interpreter ABI Platform Actions
shirka-0.0.3.macosx-10.8-x86_64.exe Details for shirka-0.0.3.macosx-10.8-x86_64.exe

Total release size: 653.2 kB

Release files / shirka-0.0.3.tar.gz

Download URL shirka-0.0.3.tar.gz
Size 571.9 kB
Tags Source
SHA-256 checksum
How to use checksums
731011ea7550a99abbb1857f05524973b8865b1c25f3e93e6db15349e44e3dc1
BLAKE2b-256 checksum
How to use checksums
984d9881eb0e9b8ad14436f895afab90368f4334b9beb502896ecf20ba77b919
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / shirka-0.0.3.macosx-10.8-x86_64.exe

Download URL shirka-0.0.3.macosx-10.8-x86_64.exe
Size 81.3 kB
Tags Source
SHA-256 checksum
How to use checksums
637a4a54de2c94aff30fc16cc20a4ba37db1f27ee38976c9d729636a89d14f08
BLAKE2b-256 checksum
How to use checksums
8f29ebdff83876efb6b9e86ab623802e2fd75c5c0520f607fac9fab1985f9c2f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for shirka 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page