Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added support for public links #241

Merged
merged 5 commits into from
Apr 15, 2020
Merged

added support for public links #241

merged 5 commits into from
Apr 15, 2020

Conversation

mrwunderbar666
Copy link
Contributor

Adds support to manipulate files in a publicly shared folder (with and without password). As described in #12

anon_session = owncloud.Client.from_public_link(public_link, password)

@PVince81
Copy link
Contributor

Great addition, thanks !

Would be good to add some unit tests.
You could use the API from within the test to create a public link, then access it using the new API and perform some operation like upload or creating a folder, then assert that the folder exists.

A slight worry might be that not all the session operations will work in anonymous mode like creating shares when connecting through that session. Might not be a big issue as calling those would result in an HTTPResponseError with code 403 or 401.

@PVince81
Copy link
Contributor

it would also be nice to add an example usage in the README :-)

@PVince81
Copy link
Contributor

that's more tests than I expected, awesome!

Copy link
Contributor

@PVince81 PVince81 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@PVince81 PVince81 merged commit af5b673 into owncloud:master Apr 15, 2020
@mrwunderbar666
Copy link
Contributor Author

Thanks!

I forgot to push the updated examples:


Example for uploading a file to a public shared folder:

.. code-block:: python

    import owncloud

    public_link = 'http://domain.tld/owncloud/A1B2C3D4'

    oc = owncloud.Client.from_public_link(public_link)
    oc.drop_file('myfile.zip')


Example for downloading a file from a public shared folder with password:

.. code-block:: python

    import owncloud

    public_link = 'http://domain.tld/owncloud/A1B2C3D4'
    folder_password = 'secret'

    oc = owncloud.Client.from_public_link(public_link, password=folder_password)
    oc.get_file('/sharedfile.zip', 'download/destination/sharedfile.zip')

@PVince81
Copy link
Contributor

@mrwunderbar666 mind sending in another PR ? else I can copy paste this later on

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants