Skip to content

Commit 6eecb2d

Browse files
authored
RSDK-4941 - use org api key in examples (#484)
1 parent d3ea4fd commit 6eecb2d

File tree

3 files changed

+3
-15
lines changed

3 files changed

+3
-15
lines changed

docs/examples/example.ipynb

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,13 +1161,7 @@
11611161
"from viam.app.viam_client import ViamClient\n",
11621162
"\n",
11631163
"async def connect() -> ViamClient:\n",
1164-
" dial_options = DialOptions(\n",
1165-
" auth_entity='<ADDRESS>', # The URL of your robot.\n",
1166-
" credentials=Credentials(\n",
1167-
" type='robot-location-secret',\n",
1168-
" payload='<SECRET>'\n",
1169-
" )\n",
1170-
" )\n",
1164+
" dial_options = DialOptions.with_api_key(api_key='<API_KEY>', api_key_id='<API_KEY_ID>')\n",
11711165
" return await ViamClient.create_from_dial_options(dial_options)"
11721166
]
11731167
},

examples/complex_module/client.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,12 @@
33
from src.gizmo import Gizmo
44
from src.summation import SummationService
55

6-
from viam import logging
76
from viam.robot.client import RobotClient
8-
from viam.rpc.dial import Credentials, DialOptions
97
from viam.components.base import Base
108

119

1210
async def connect():
13-
creds = Credentials(type="<your authentication type here>", payload="<your authentication payload here>")
14-
opts = RobotClient.Options(refresh_interval=0, dial_options=DialOptions(credentials=creds), log_level=logging.DEBUG)
11+
opts = RobotClient.Options.with_api_key(api_key="<your api key here>", api_key_id="<your api key ID here>")
1512
return await RobotClient.at_address("<your robot uri here>", opts)
1613

1714

examples/simple_module/client.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
import asyncio
22

3-
from viam import logging
43
from viam.robot.client import RobotClient
5-
from viam.rpc.dial import Credentials, DialOptions
64
from viam.components.sensor import Sensor
75

86

97
async def connect():
10-
creds = Credentials(type="<your authentication type here>", payload="<your authentication payload here>")
11-
opts = RobotClient.Options(refresh_interval=0, dial_options=DialOptions(credentials=creds), log_level=logging.DEBUG)
8+
opts = RobotClient.Options.with_api_key(api_key="<your api key here>", api_key_id="<your api key ID here>")
129
return await RobotClient.at_address("<your robot uri here>", opts)
1310

1411

0 commit comments

Comments
 (0)