Problem with listing device profiles

I am trying to get a list of device profiles using GRPC. My python code is:

import grpc
from chirpstack_api import api
api_token = " … my api token …"
grpcserver = “10.66.68.101:8080”
channel = grpc.insecure_channel(grpcserver)
client = api.DeviceServiceStub(channel)
auth_token = [(“authorization”, “Bearer %s” % api_token)]

req = api.ListDeviceProfilesRequest()
req.limit = 100
req.offset = 0
req.tenant_id = “52f14cd4-c6f1-4fbd-8f87-4025e1d49242”
response = client.List(req, metadata=auth_token)
print(f"{response.total_count} results found")

I always get a zero ‘total_count’, even if a few device profiles exist.
Can anybody please give me a hint why this doesn’t work?

Chirpstack version is 4.5.1 and chirpstack-api package is version 4.6.0.

Thank you in advance

This should be:

api.deviceProfileServiceStub(channel)

Depending on what section of the API protocol the call is in, you must use the associated service stub.

1 Like