Skip to content

Commit

Permalink
refac: Move to src/ layout
Browse files Browse the repository at this point in the history
  • Loading branch information
deepbrook committed Feb 14, 2022
1 parent 07ce824 commit 09be0ed
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 32 deletions.
9 changes: 0 additions & 9 deletions .travis.yml

This file was deleted.

19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,33 +21,38 @@ This module depends on websocket-client module available from: <http://github.co
Example of using this pusher client to consume websockets:

```python

import pysher

# Add a logging handler so we can see the raw communication data
import logging

root = logging.getLogger()
root.setLevel(logging.INFO)
ch = logging.StreamHandler(sys.stdout)
root.addHandler(ch)

pusher = pysher.Pusher(appkey)

def my_func(*args, **kwargs):
print("processing Args:", args)
print("processing Kwargs:", kwargs)

def my_func(*args, **kwargs):
print("processing Args:", args)
print("processing Kwargs:", kwargs)


# We can't subscribe until we've connected, so we use a callback handler
# to subscribe when able
def connect_handler(data):
channel = pusher.subscribe('mychannel')
channel.bind('myevent', my_func)
channel = pusher.subscribe('mychannel')
channel.bind('myevent', my_func)


pusher.connection.bind('pusher:connection_established', connect_handler)
pusher.connect()

while True:
# Do other things in the meantime here...
time.sleep(1)
# Do other things in the meantime here...
time.sleep(1)
```

Sending pusher events to a channel can be done simply using the pusher client supplied by pusher. You can get it here: <https://github.com/pusher/pusher-http-python>
Expand Down
4 changes: 0 additions & 4 deletions requirements.txt

This file was deleted.

16 changes: 10 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env python
from setuptools import find_packages
from setuptools import setup

VERSION = "1.0.6"

requirements = ["websocket-client!=0.49"]
VERSION = "1.0.7"


def readme():
Expand All @@ -19,9 +19,13 @@ def readme():
author="Nils Diefenbach",
author_email="[email protected]",
license="MIT",
url="https://github.com/nlsdfnbch/Pysher",
install_requires=requirements,
packages=["pysher"],
url="https://github.com/deepbrook/Pysher",
packages=find_packages('src'),
package_dir={'': 'src'},
install_requires=[
"websocket-client!=0.49",
],
tests_requires=["autobahn"],
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Web Environment',
Expand Down
5 changes: 2 additions & 3 deletions pysher/__init__.py → src/pysher/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from pysher.pusher import Pusher
from pysher.connection import Connection
from pysher.channel import Channel

from pysher.pusher import Pusher

__all__ = ["Connection", "Pusher"]
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion pysher/pusher.py → src/pysher/pusher.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import logging
import json

VERSION = '0.6.0'
VERSION = '1.0.7'


class Pusher(object):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_pusherclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
global exit_code


def test_channel_callback(data):
def channel_callback_test(data):
global exit_code
print("Client: %s" % data)

Expand All @@ -46,7 +46,7 @@ def test_channel_callback(data):

def connect_handler(data):
channel = client.subscribe("test_channel")
channel.bind('test_event', test_channel_callback)
channel.bind('test_event', channel_callback_test)


def stop_test():
Expand Down

0 comments on commit 09be0ed

Please sign in to comment.