Ich kann keine Verbindung zu Azure Signalr aus meinem Python -Backend -Code herstellenPython

Python-Programme
Anonymous
 Ich kann keine Verbindung zu Azure Signalr aus meinem Python -Backend -Code herstellen

Post by Anonymous »

Ich möchte eine Nachricht an meinen Azure SignalR verwenden. Ich benutze 'Kommunikationstiftrate', um den Acess -Token zu erhalten. Aber wenn ich versuche, < /p>

identity = client.create_user () < /p>
< /blockquote>
Ich erhalte 403 -Fehler.

Code: Select all

from datetime import timedelta
from azure.communication.identity import CommunicationIdentityClient

connection_string = "Endpoint=https://signalrpro.service.signalr.net;AccessKey=acc;Version=1.0;"

client = CommunicationIdentityClient.from_connection_string(connection_string)
identity = client.create_user()
print("\nCreated an identity with ID: " + identity.properties['id'])
# Issue an access token with a validity of 24 hours and the "voip" scope for an identity
# Issue an access token with a validity of an hour and the "voip" scope for an identity
token_expires_in = timedelta(hours=1)
token_result = client.get_token(identity, ["voip"], token_expires_in=token_expires_in)
#token_result = client.get_token(identity, ["voip"])
print("\nIssued an access token with 'voip' scope that expires at " + token_result.expires_on + ":")
print(token_result.token)
Bearbeiten: Ich sieht aus, als wäre KommunikationIdentitätsclient keine gültige Bibliothek für SignalR. In diesem Fall sollte ich eine Verbindung zu SignalR?

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post