Hey, I have a question regarding the following topic: Chirpstack API and its use in Python. My problem is that I have been trying to retrieve data through the Chirpstack API using Python for some time now, but it just doesn’t seem to work for me. I can’t seem to find any proper examples except in the Chirpstack V4 documentation, which unfortunately doesn’t help me much. I have created a server on my PC via the grpcui server, which is located on a port on my PC and connected to the Chirpstack website and my devices. When I enter my token on the grpcui page as described in the Chirpstack V4 documentation, I also receive a response and the correct result, but I just can’t seem to write the ApplicationServiceStub(channel) and api.GetApplicationRequest, especially since there seems to be no api.GetApplicationRequest for me. Maybe someone here is familiar with the topic and can help me out. That would be much appreciated.
Thanks in advance.
server = “http://127.0.0.1:50338”
api_token = “”
if name == “main”:
# Connect without using TLS.
channel = grpc.insecure_channel(server)
print("Channel: ", channel)
client = api.ApplicationServiceStub(channel)
print("Client: ", client)
# Define the API key meta-data. auth_token = [("authorization", "Bearer %s" % api_token)] print("Auth_token: ", auth_token) if requests.get(server) == 200: print("Server is running") else: print("Server is not running") # Abfrage nach der Anwendung mit ID = "00000000000000000000000000000008" app_id = "00000000000000000000000000000008 req = api.GetApplicationRequest(id=app_id) resp = client.GetApplication(req, metadata=auth_token) print("Response: ", resp)