diff --git a/doc/index.rst b/doc/index.rst index 27f246c..4f219e0 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -310,9 +310,9 @@ Retrieving Files A convenient wrapper around :py:meth:`Zotero.file()`. Writes an attachment to disk using the optional path and filename. If neither are supplied, the file is written to the current working directory, and a :py:meth:`Zotero.item()` call is first made to determine the attachment - filename. No error checking is done regarding the path. + filename. No error checking is done regarding the path. If successful, the full path including the file name is returned. - .. note:: HTML snapshots will be dumped as zip files, with "zip" appended to the file name. + .. note:: HTML snapshots will be dumped as zip files. These will be named with their API item key, and a .zip extension. .. code-block:: python diff --git a/pyzotero/zotero.py b/pyzotero/zotero.py index 0888fc4..e128985 100644 --- a/pyzotero/zotero.py +++ b/pyzotero/zotero.py @@ -592,7 +592,7 @@ def dump(self, itemkey, filename=None, path=None): try: filename = self.item(itemkey)['data']['filename'] except TypeError: - filename = "item.html.zip" + filename = "{i}.zip".format(i=itemkey) if path: pth = os.path.join(path, filename) else: @@ -600,6 +600,7 @@ def dump(self, itemkey, filename=None, path=None): to_write = self.file(itemkey) with open(pth, 'wb') as f: f.write(to_write) + return pth @retrieve def children(self, item, **kwargs):