Skip to content

Conversation

@0x676e67
Copy link
Owner

No description provided.

@0x676e67 0x676e67 requested a review from Copilot December 14, 2025 12:41
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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> to Option<Duration> for all timeout, TCP keepalive, and pool idle timeout parameters
  • Updated Python type stubs to use datetime.timedelta instead of int for duration parameters
  • Removed Duration::from_secs conversions in Rust code as Duration objects are now passed directly
  • Updated examples to demonstrate the new datetime.timedelta usage

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants