summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime “pep” Buquet <pep@bouah.net>2022-03-17 20:59:05 +0100
committerMaxime “pep” Buquet <pep@bouah.net>2022-03-19 10:31:34 +0100
commit3c08f471cff6df37ff6ac447b770546e94ef4815 (patch)
tree60a39add6e613deac62d9aa57f084b2c69af94ca
parent54b724c28b1048d8508f1523693d4f7df340fc13 (diff)
downloadslixmpp-3c08f471cff6df37ff6ac447b770546e94ef4815.tar.gz
slixmpp-3c08f471cff6df37ff6ac447b770546e94ef4815.tar.bz2
slixmpp-3c08f471cff6df37ff6ac447b770546e94ef4815.tar.xz
slixmpp-3c08f471cff6df37ff6ac447b770546e94ef4815.zip
xep_0363: change filename to Path
This shouldn't break anything as I'm not using Path specific APIs Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
-rw-r--r--slixmpp/plugins/xep_0363/http_upload.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/slixmpp/plugins/xep_0363/http_upload.py b/slixmpp/plugins/xep_0363/http_upload.py
index bae3ee7d..4a185fb9 100644
--- a/slixmpp/plugins/xep_0363/http_upload.py
+++ b/slixmpp/plugins/xep_0363/http_upload.py
@@ -14,6 +14,8 @@ from typing import (
IO,
)
+from pathlib import Path
+
from slixmpp import JID, __version__
from slixmpp.stanza import Iq
from slixmpp.plugins import BasePlugin
@@ -113,7 +115,7 @@ class XEP_0363(BasePlugin):
if feature == Request.namespace:
return info
- def request_slot(self, jid: JID, filename: str, size: int,
+ def request_slot(self, jid: JID, filename: Path, size: int,
content_type: Optional[str] = None, *,
ifrom: Optional[JID] = None, **iqkwargs) -> Future:
"""Request an HTTP upload slot from a service.
@@ -125,12 +127,12 @@ class XEP_0363(BasePlugin):
"""
iq = self.xmpp.make_iq_get(ito=jid, ifrom=ifrom)
request = iq['http_upload_request']
- request['filename'] = filename
+ request['filename'] = str(filename)
request['size'] = str(size)
request['content-type'] = content_type or self.default_content_type
return iq.send(**iqkwargs)
- async def upload_file(self, filename: str, size: Optional[int] = None,
+ async def upload_file(self, filename: Path, size: Optional[int] = None,
content_type: Optional[str] = None, *,
input_file: Optional[IO[bytes]]=None,
domain: Optional[JID] = None,