Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the client API to use datetime.timedelta objects instead of numeric integer values (representing seconds) for all duration-related parameters. This affects both the Rust backend (which now uses std::time::Duration directly) and the Python frontend (which now accepts datetime.timedelta objects). The refactoring improves API clarity by making time units explicit and enables more precise duration specifications.
- Changed Rust type fields from
Option<u64>toOption<Duration>for all timeout, TCP keepalive, and pool idle timeout parameters - Updated Python type stubs to use
datetime.timedeltainstead ofintfor duration parameters - Removed
Duration::from_secsconversions in Rust code as Duration objects are now passed directly - Updated examples to demonstrate the new
datetime.timedeltausage
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| src/client/req.rs | Changed timeout and read_timeout fields from u64 to Duration; removed Duration::from_secs conversions |
| src/client.rs | Changed all timeout, TCP keepalive, and pool timeout fields from u64 to Duration; removed Duration::from_secs conversions |
| python/rnet/init.pyi | Updated type hints from int to datetime.timedelta for all duration parameters; includes unrelated changes (Message.json return type, formatting) |
| python/rnet/tls.py | Added str type support to KeyLog.file() path parameter (unrelated to main PR purpose) |
| python/examples/exceptions.py | Updated timeout usage to datetime.timedelta |
| python/examples/blocking/get.py | Updated timeout usage to datetime.timedelta |
| python/examples/orig_headers.py | Added null check for WebSocket message (unrelated to main PR purpose) |
| python/examples/keylog.py | Removed unused import (unrelated cleanup) |
| python/examples/blocking/proxy.py | Updated proxy usage to Proxy.all() (unrelated to main PR purpose) |
| python/examples/dns_override.py | Deleted file |
Comments suppressed due to low confidence (1)
python/examples/keylog.py:7
- The result of KeyLog.file is used even though it is always None.
client = Client(keylog=KeyLog.file("keylog.log"))
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.