-
Notifications
You must be signed in to change notification settings - Fork 48
Open
Description
Hey,
as far as I understand the documentation and the code of the class itself, no functionality for uploading a file is given.
I am able to connect to a Seafile server and create an empty file with this URL:
file_name = os.path.basename(file_path) file_url = os.path.join(server_url, 'lib', repo_id, 'file', file_name)
Is there a better alternative implemented than using the existing requests library and simply post the file content?
response = requests.post(file_url, files=files, headers=headers)
with
auth_response = requests.post(f"{server_url}api2/auth-token/", data={'username': username, 'password': password})
token = auth_response.json().get('token')
headers = {'Authorization': f'Token {token}'}
files = {'file': (file_name, open(file_path, 'rb'))}
I am happy about any recommendations to some more detailed documentation or a code example.
Later on, I can add the solution to the documentation for following users.
Metadata
Metadata
Assignees
Labels
No labels