Mendeley / mendeley-python-sdk

Python SDK for the Mendeley API.
Apache License 2.0
119 stars 59 forks source link

Add support for folders #23

Open cjblocker opened 5 years ago

cjblocker commented 5 years ago

Fixes #4 folders exist as a property of the root Mendeley session and on any group object.

I haven't written any docs or tests yet (besides my own tests while developing), but would be happy to add some if interested in merging.

Example Usage:

fold = mendeley_session.folders.list().items[0]
testfold = mendeley_session.folders.create('0000Test Folder0000') #creates a root folder
test_subfold = testfold.create('000Test Subfolder000') # creates a subfolder fo testfold
assert test_subfold.parent == testfold

doc = fold.documents.list(view='all')[0]
test_subfold.add_document(doc)
test_subfold.remove_document(doc)

print("Subfolder name: {}".format(test_subfold.name))
print("Parent folder name:{}".format(test_subfold.parent.name))
may1066 commented 4 years ago

This would be really useful, is it likely to be updated?