summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Turner <jturner.usa@gmail.com>2025-09-11 00:57:31 -0400
committerJohn Turner <jturner.usa@gmail.com>2025-09-11 00:57:31 -0400
commit76c05a62b65c350b97c063cf75523546af7879d5 (patch)
tree2647cc465aa456011cfa117970795ad7d439fbc6
parent4d6e941709b60f7f6738c908a89824a67ead6c28 (diff)
downloadpypaste-76c05a62b65c350b97c063cf75523546af7879d5.tar.gz
impl client backend for pgz
-rw-r--r--pypaste/client/plugins/pgz/__init__.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/pypaste/client/plugins/pgz/__init__.py b/pypaste/client/plugins/pgz/__init__.py
new file mode 100644
index 0000000..a916c19
--- /dev/null
+++ b/pypaste/client/plugins/pgz/__init__.py
@@ -0,0 +1,24 @@
+import io
+import requests
+from pypaste.client import PasteService
+from pypaste.client.plugins import register_service
+from typing import Optional, List
+
+URL: str = "https://paste.gentoo.zip"
+
+@register_service("pgz")
+class Pgz:
+
+ def paste(self, buffer: io.BytesIO, syntax: Optional[str], raw: bool) -> str:
+ files = {"file": ("pypaste-upload", buffer, "multipart/form-data")}
+
+ req = requests.post(URL, files=files)
+
+ if req.status_code != 200:
+ raise Exception(f"failed to paste to pgz: status code: {req.status_code}")
+
+ return req.text.strip()
+
+
+ def supported_syntaxes(self) -> List[str]:
+ return []