Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python(chore): ping example #130

Merged
merged 3 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions python/examples/ping/.env-example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SIFT_API_KEY=
BASE_URI=
24 changes: 24 additions & 0 deletions python/examples/ping/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import os

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

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
Loading