Skip to content

Commit 7dd125a

Browse files
committed
put example: use uri parameter rahter than setting path components manually
Manipulating the path stays possible but is not something that should be shown to newcomers first time they use the library, as it is much more prone to errors.
1 parent dca4f14 commit 7dd125a

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

clientPUT.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,7 @@ async def main():
3030
await asyncio.sleep(2)
3131

3232
payload = b"The quick brown fox jumps over the lazy dog.\n" * 30
33-
request = Message(code=PUT, payload=payload)
34-
# These direct assignments are an alternative to setting the URI like in
35-
# the GET example:
36-
request.opt.uri_host = '127.0.0.1'
37-
request.opt.uri_path = ("other", "block")
33+
request = Message(code=PUT, payload=payload, uri="coap://localhost/other/block")
3834

3935
response = await context.request(request).response
4036

0 commit comments

Comments
 (0)