Xuanwo commented on code in PR #2950:
URL:
https://github.com/apache/incubator-opendal/pull/2950#discussion_r1306900574
##########
bindings/python/src/lib.rs:
##########
@@ -368,6 +368,34 @@ impl EntryMode {
}
}
+#[pyclass(module = "opendal")]
+struct PresignedRequest(od::raw::PresignedRequest);
+
+#[pymethods]
+impl PresignedRequest {
+ /// Return the URL of this request.
+ #[getter]
+ pub fn url(&self) -> String {
+ self.0.uri().to_string()
+ }
+
+ /// Return the HTTP method of this request.
+ #[getter]
+ pub fn method(&self) -> &str {
+ self.0.method().as_str()
+ }
+
+ /// Return the HTTP headers of this request.
+ #[getter]
+ pub fn headers<'p>(&'p self, py: Python<'p>) -> HashMap<&'p str, &'p
PyBytes> {
Review Comment:
It's better to return a `HashMap<&'p str, &'p str>` here. We should raise
exception when:
- HeaderMap has a multi-value header (should not happen for opendal
generated presign request).
- HeaderMap has an invliad header value (It's required that all header value
must be encoded).
--
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]