slbotbm commented on code in PR #3776:
URL: https://github.com/apache/iggy/pull/3776#discussion_r3677429626


##########
examples/python/client-configuration/main.py:
##########


Review Comment:
   There's no need for an extra example for the new config. Let's fold this 
into the getting-started/ example



##########
examples/python/README.md:
##########


Review Comment:
   No need for this extra change if the above example gets folded in 
getting-started.



##########
foreign/python/README.md:
##########
@@ -58,6 +58,44 @@ maturin develop
 pytest tests/ -v # Run tests (requires iggy-server running)
 ```
 
+## Client Configuration
+
+`IggyClient` takes either a server address or a `TcpConfig`. Configuring 
`auto_login`
+lets the SDK replay the credentials whenever it reconnects, so a session 
dropped by a
+server restart is recovered instead of surfacing as `Unauthenticated`:
+
+```python
+import asyncio
+from datetime import timedelta
+
+from apache_iggy import AutoLogin, IggyClient, TcpConfig, TcpReconnectionConfig
+
+
+async def main():
+    client = IggyClient(
+        TcpConfig(
+            server_address="127.0.0.1:8090",
+            auto_login=AutoLogin.username_password("iggy", "iggy"),
+            reconnection=TcpReconnectionConfig(
+                enabled=True,
+                max_retries=10,
+                interval=timedelta(seconds=2),
+                reestablish_after=timedelta(seconds=30),
+            ),
+            heartbeat_interval=timedelta(seconds=5),
+        )
+    )
+    await client.connect()
+
+
+asyncio.run(main())
+```
+
+`TcpConfig` also carries `tls_enabled`, `tls_domain`, `tls_ca_file`,
+`tls_validate_certificate` and `nodelay`. Every field is keyword-only and 
defaults to the
+same value the Rust SDK uses. `IggyClient.from_connection_string(...)` remains 
available
+for the same settings in string form.

Review Comment:
   You could show these as commented out options in the above config instead of 
mentioning them here. No need to mention anything about 
`from_connection_string` here.



##########
foreign/python/README.md:
##########
@@ -58,6 +58,44 @@ maturin develop
 pytest tests/ -v # Run tests (requires iggy-server running)
 ```
 
+## Client Configuration
+
+`IggyClient` takes either a server address or a `TcpConfig`. Configuring 
`auto_login`
+lets the SDK replay the credentials whenever it reconnects, so a session 
dropped by a
+server restart is recovered instead of surfacing as `Unauthenticated`:

Review Comment:
   No need to mention the `auto_login` option specially. That is for the API 
comment docs.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to