Giter VIP home page Giter VIP logo

jeev's Issues

SSL error when reconnecting

I figured this would be the best place to keep this.

I've made changes so that Jeev tries to reconnect after a websocket connection is closed (When it gets a ConnectionAlreadyClosed(?) exception from the websocket client slack uses), but it seems to have gotten an SSL error now on the reconnect.

ERROR:jeev.adapter.slack:WebSocket connection closed.
Traceback (most recent call last):
  File "/home/ubuntu/jeev-pt/local/lib/python2.7/site-packages/gevent-1.0.2-py2.7-linux-x86_64.egg/gevent/greenlet.py", line 327, in run
    result = self._run(*self.args, **self.kwargs)
  File "/home/ubuntu/jeev-pt/local/lib/python2.7/site-packages/jeev-0.3.0b0-py2.7.egg/jeev/adapter/slack.py", line 340, in _run
    self._do_slack_connection()
  File "/home/ubuntu/jeev-pt/local/lib/python2.7/site-packages/jeev-0.3.0b0-py2.7.egg/jeev/adapter/slack.py", line 355, in _do_slack_connection
    frame = self._server.websocket.recv()
  File "/home/ubuntu/jeev-pt/local/lib/python2.7/site-packages/websocket_client-0.32.0-py2.7.egg/websocket/_core.py", line 348, in recv
    opcode, data = self.recv_data()
  File "/home/ubuntu/jeev-pt/local/lib/python2.7/site-packages/websocket_client-0.32.0-py2.7.egg/websocket/_core.py", line 365, in recv_data
    opcode, frame = self.recv_data_frame(control_frame)
  File "/home/ubuntu/jeev-pt/local/lib/python2.7/site-packages/websocket_client-0.32.0-py2.7.egg/websocket/_core.py", line 378, in recv_data_frame
    frame = self.recv_frame()
  File "/home/ubuntu/jeev-pt/local/lib/python2.7/site-packages/websocket_client-0.32.0-py2.7.egg/websocket/_core.py", line 410, in recv_frame
    return self.frame_buffer.recv_frame()
  File "/home/ubuntu/jeev-pt/local/lib/python2.7/site-packages/websocket_client-0.32.0-py2.7.egg/websocket/_abnf.py", line 300, in recv_frame
    self.recv_header()
  File "/home/ubuntu/jeev-pt/local/lib/python2.7/site-packages/websocket_client-0.32.0-py2.7.egg/websocket/_abnf.py", line 249, in recv_header
    header = self.recv_strict(2)
  File "/home/ubuntu/jeev-pt/local/lib/python2.7/site-packages/websocket_client-0.32.0-py2.7.egg/websocket/_abnf.py", line 334, in recv_strict
    bytes = self.recv(min(16384, shortage))
  File "/home/ubuntu/jeev-pt/local/lib/python2.7/site-packages/websocket_client-0.32.0-py2.7.egg/websocket/_core.py", line 476, in _recv
    return recv(self.sock, bufsize)
  File "/home/ubuntu/jeev-pt/local/lib/python2.7/site-packages/websocket_client-0.32.0-py2.7.egg/websocket/_socket.py", line 77, in recv
    bytes = sock.recv(bufsize)
  File "/home/ubuntu/jeev-pt/local/lib/python2.7/site-packages/gevent-1.0.2-py2.7-linux-x86_64.egg/gevent/_ssl2.py", line 204, in recv
    return self.read(buflen)
  File "/home/ubuntu/jeev-pt/local/lib/python2.7/site-packages/gevent-1.0.2-py2.7-linux-x86_64.egg/gevent/_ssl2.py", line 109, in read
    return self._sslobj.read(len)
SSLError: [Errno 2] _ssl.c:1429: The operation did not complete (read)
<Greenlet at 0x7f0f3c580730: <bound method SlackAdapter._run of <jeev.adapter.slack.SlackAdapter object at 0x7f0f3d0c8c90>>> failed with SSLError

Module command documentation parsing inside docstr + help command

Need to have a way to reveal to the user the list of commands.

I was thinking that handlers with a docstr, should be parsed and added to a list. I.e.

@module.respond("what is the weather in (.*)")
def weather(message, where):
    "what is the weather in {location} - Gets the weather in location"
    ... code here ...

Finish writing documentation

Need to finish writing documentation for:

  • Modules
  • Your First Module
  • Web Module
  • Module best practices
  • Adapters
  • Deployment

Module option config

Want to expose an interface such that we can do:

import module

# A required option.
module.opt(
    "option_name", 
    description="This is the description for option_name")

# An optional option, with a default of 5, and will be cast to an int when read.
module.opt(
    "max_number_of_something",
    description="The max number of something",
    default=5,
    cast=int)

@module.opt_validator('max_number_of_something')
def less_than_100(value):
    if value > 100:
        raise module.ConfigError("Must be less than 100!!")

When the module is loaded, it will check for the presence of option_name in the config (and the ENVIRON), and throw an error if it's not.

Then I can expose a function like jeev chkconfig --module mod_name that will do a check to see if everything is set properly.

I can also expose a function jeev modopts mod_name that will print a list of the module options (what they're set to, and what's missing).

This should help module devs be explicit about their dependencies, and let users debug what's missing really easily.

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.