Skip to main content

Python binding for Tox the skype replacement

Project description

https://travis-ci.org/aitjcize/PyTox.png?branch=master https://pypip.in/v/PyTox/badge.png https://pypip.in/d/PyTox/badge.png

PyTox

Python binding for Project Tox.

PyTox provides a Pythonic binding, i.e Object-oriented instead of C style, raise exception instead of returning error code. A simple example is as follows:

class EchoBot(Tox):
    def loop(self):
        while True:
            self.do()
            time.sleep(0.03)

    def on_friend_request(self, pk, message):
        print 'Friend request from %s: %s' % (pk, message)
        self.add_friend_norequest(pk)
        print 'Accepted.'

    def on_friend_message(self, friendId, message):
        name = self.getname(friendId)
        print '%s: %s' % (name, message)
        print 'EchoBot: %s' % message
        self.send_message(friendId, message)

As you can see callbacks are mapped into class method instead of using it the the c ways. For more details please refer to examples/echo.py.

Examples

  • echo.py: A working echo bot that wait for friend requests, and than start echoing anything that friend send.

Documentation

Full API documentation can be read here.

Contributing

  1. Fork it

  2. Create your feature branch (git checkout -b my-new-feature)

  3. Commit your changes (git commit -am 'Add some feature')

  4. Push to the branch (git push origin my-new-feature)

  5. Create new Pull Request

https://cruel-carlota.pagodabox.com/f7c9269a8398926d869e54744b334c26

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PyTox-0.0.10.tar.gz (23.1 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page