i have setup nextcloud locally in ubuntu using snap install nextcloud its working fine, now i want to login using python i have tried some libraries like
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=80): Max retries exceeded with url: /index.php/login/ocs/v1.php/cloud/capabilities (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fb4e263a490>: Failed to establish a new connection: [Errno 111] Connection refused'))
In your first one, what result are you expecting? Youβre just logging in. You have to trigger an operation after logging in I imagine to get anything.
What libraries are you using? (I can kind of guess, but your making us do more work than is necessary to help you hah).
You can/should check your Nextcloud logs if you want to get additional context about login failures.
I suggest you search the forum. There are relevant posts.
In nc_py_api I did not add possibility to do so, but if there will be strong argumented request for this I can add it in next upcoming version.
As a workaround I can suggest updating capabilities variable, as in most cases it will be updated after login anyway and cached, so reading it manually what will trigger it caching and will not impact performance in any way.
nc = nc_py_api.Nextcloud(
nc_auth_user="admin",
nc_auth_pass="admin",
nextcloud_url="http://stable27.local"
)
try:
nc.update_server_info()
except nc_py_api.NextcloudException as e:
print(e) # will be 401 in case of Auth error