Open andersonrocha0 opened 1 year ago
When I call
channels_client.send_to_user("123", "user-event", {"message": "hello worlds"})
I get this error (although the message goes through to my client)
File "/Users/benjamintang/development/python/channels/app.py", line 124, in send_to_user
channels_client.send_to_user("123", "user-event", {"message": "hello worlds"})
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/benjamintang/development/python/channels/venv/lib/python3.11/site-packages/pusher/pusher.py", line 151, in send_to_user
return self._pusher_client.send_to_user(user_id, event_name, data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/benjamintang/development/python/channels/venv/lib/python3.11/site-packages/pusher/http.py", line 31, in __call__
return self.client.http.send_request(self.make_request(*args, **kwargs))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/benjamintang/development/python/channels/venv/lib/python3.11/site-packages/pusher/requests.py", line 39, in send_request
self.session = requests.Session()
def send_request(self, request):
resp = self.session.request(
request.method,
^^^^^^^^^^^^^^
request.url,
headers=request.headers,
data=request.body,
timeout=self.client.timeout,
**self.options)
AttributeError: 'dict' object has no attribute 'method'
Do you not get this too? It's odd, as the trigger() method should put POST as the argument, so I'm not sure where its going missing.
@andersonrocha0
@benjamin-tang-pusher Yes, you are right.
I found the problem and fixed it.
The @request_method is unnecessary because the send_to_user is only a wrapper calling the trigger.
Now, the code is fixed and working.
Please let me know if you have any other problems.
:)
Whoops, I forgot about that decorator. I gave it another test and it works now.
I will ask the team to review it.
@fbenevides do you have any news?
Thx.
+1, need this
Any news here?
@fbenevides any updates on this PR? Would be super helpful to have 😄
@amad @robertoles @benjamin-tang-pusher @benw-pusher I'm tagging you because you were the last committers on this project. Do you have any intention to finish this PR?
Thanks for any help you can give me.
:)
What does this PR do?
Add the authenticate_user method allowing clients to authenticate users. Add the send_to_user_method allowing any backend to send messages to a specific user.
requirements.txt
andsetup.py
have been updatedCHANGELOG