Astarte message hub protocol buffers for Python
Project description
Astarte message hub protocol buffers for Python
This module provides access to the Astarte message hub protocol buffers through a Python API.
Basic usage
Use pip to install the astarte-message-hub-proto package.
Then include and use it in your sources as follows:
from datetime import datetime, timezone
import grpc
from google.protobuf.timestamp_pb2 import Timestamp
from astarteplatform.msghub.message_hub_service_pb2_grpc import MessageHubStub
from astarteplatform.msghub.node_pb2 import Node
from astarteplatform.msghub.astarte_message_pb2 import AstarteMessage
from astarteplatform.msghub.astarte_type_pb2 import AstarteDataType, AstarteDataTypeIndividual
grpc_channel = grpc.insecure_channel("server address")
message_hub_stub = MessageHubStub(grpc_channel)
message_hub_node = Node(uuid="node uuid", interfaces_json=[b"interface 1 bin", b"interface 2 bin"])
message_hub_stream = message_hub_stub.Attach(message_hub_node)
# Transmit a very simple message
protobuf_value = AstarteDataType(astarte_individual=AstarteDataTypeIndividual(astarte_double=42.1))
protobuf_timestamp = Timestamp()
protobuf_timestamp.FromDatetime(datetime.now(tz=timezone.utc))
msg = AstarteMessage(
'interface_name'="interface name",
'path'="path",
'timestamp'=protobuf_timestamp,
'astarte_data'=protobuf_value)
message_hub_stub.Send(msg)
# Never ending receive loop
for astarte_message in message_hub_stream:
# Parse astarte_message (AstarteMessage) as you see fit.
print(astarte_message.interface_name)
print(astarte_message.path)
print(astarte_message.WhichOneof("payload"))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file astarte_message_hub_proto-0.8.1.tar.gz.
File metadata
- Download URL: astarte_message_hub_proto-0.8.1.tar.gz
- Upload date:
- Size: 10.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c95285f855806b6d96862b1d1deea4d6ee0bb5a8379355fd026b466cf9b16863
|
|
| MD5 |
5d6b44a44fd8817f907cffa5cbf9c785
|
|
| BLAKE2b-256 |
7c38e30f24689fed0108c4f1302835a1e81174b9479da49a4809c97712db85c9
|
Provenance
The following attestation bundles were made for astarte_message_hub_proto-0.8.1.tar.gz:
Publisher:
python-publish.yaml on astarte-platform/astarte-message-hub-proto
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
astarte_message_hub_proto-0.8.1.tar.gz -
Subject digest:
c95285f855806b6d96862b1d1deea4d6ee0bb5a8379355fd026b466cf9b16863 - Sigstore transparency entry: 244783420
- Sigstore integration time:
-
Permalink:
astarte-platform/astarte-message-hub-proto@6937bc745db80ec518ec553b01d4a8db62a4be7d -
Branch / Tag:
refs/tags/v0.8.1 - Owner: https://github.com/astarte-platform
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yaml@6937bc745db80ec518ec553b01d4a8db62a4be7d -
Trigger Event:
push
-
Statement type:
File details
Details for the file astarte_message_hub_proto-0.8.1-py3-none-any.whl.
File metadata
- Download URL: astarte_message_hub_proto-0.8.1-py3-none-any.whl
- Upload date:
- Size: 23.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c2038a37bfd7b51bb403e3039ac877ccfef69f4535e632c13215089db50691d
|
|
| MD5 |
a314c234e201643d14495ba7ac27a46a
|
|
| BLAKE2b-256 |
4329829019f1eecec8d5c8f0a25f12c4926fdebccdb4aba1c9945930aa796ed5
|
Provenance
The following attestation bundles were made for astarte_message_hub_proto-0.8.1-py3-none-any.whl:
Publisher:
python-publish.yaml on astarte-platform/astarte-message-hub-proto
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
astarte_message_hub_proto-0.8.1-py3-none-any.whl -
Subject digest:
8c2038a37bfd7b51bb403e3039ac877ccfef69f4535e632c13215089db50691d - Sigstore transparency entry: 244783426
- Sigstore integration time:
-
Permalink:
astarte-platform/astarte-message-hub-proto@6937bc745db80ec518ec553b01d4a8db62a4be7d -
Branch / Tag:
refs/tags/v0.8.1 - Owner: https://github.com/astarte-platform
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yaml@6937bc745db80ec518ec553b01d4a8db62a4be7d -
Trigger Event:
push
-
Statement type: