Skip to content

Commit

Permalink
python(chore): ping example
Browse files Browse the repository at this point in the history
  • Loading branch information
solidiquis committed Nov 12, 2024
1 parent a27ac8b commit 9f833c3
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
25 changes: 25 additions & 0 deletions python/examples/ping/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import os

from dotenv import load_dotenv
from sift_py.grpc.transport import SiftChannelConfig, use_sift_channel
from sift.ping.v1.ping_pb2 import PingRequest
from sift.ping.v1.ping_pb2_grpc import PingServiceStub


if __name__ == "__main__":
load_dotenv()

apikey = os.getenv("SIFT_API_KEY")
assert apikey

uri = os.getenv("BASE_URI")
assert uri

channel_config: SiftChannelConfig = {
"apikey": apikey,
"uri": uri,
}

with use_sift_channel(channel_config) as channel:
response = PingServiceStub(channel).Ping(PingRequest())
print(response)
2 changes: 2 additions & 0 deletions python/examples/ping/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
python-dotenv
sift-stack-py==0.3.0rc3

0 comments on commit 9f833c3

Please sign in to comment.