Skip to content

Commit 406f15d

Browse files
committed
Don't make File.attachment_url a mandatory parameter
1 parent cf509bf commit 406f15d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mystbin/paste.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class File:
5959
"_character_count",
6060
)
6161

62-
def __init__(self, *, filename: str, content: str, attachment_url: Optional[str]) -> None:
62+
def __init__(self, *, filename: str, content: str, attachment_url: Optional[str] = None) -> None:
6363
self.filename: str = filename
6464
self.content: str = content
6565
self.attachment_url: Optional[str] = attachment_url
@@ -147,7 +147,7 @@ def from_data(cls, payload: PasteResponse, /) -> Self:
147147
files = [File.from_data(data) for data in payload["files"]]
148148
self = cls(id=payload["id"], created_at=payload["created_at"], files=files, notice=payload["notice"])
149149
self._views = payload.get("views")
150-
last_edited = payload["last_edited"]
150+
last_edited = payload.get("last_edited")
151151
if last_edited:
152152
self._last_edited = datetime.datetime.fromisoformat(last_edited)
153153
else:

0 commit comments

Comments
 (0)