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
from nextcloud import NextCloud
nxc = NextCloud(
but its not return eny thing or error, next this is
oc = owncloud.Client('http://localhost/index.php/login')
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'))
kindly tell me its solution
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.
As Author of NextcloudPythonFramework I will be glad to answer of any questions related to Nextcloud and Python here or on GitHub.
how to verify that user sucessfully loggedin using python and without perform any operation???
Check return code from login request?
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(
except nc_py_api.NextcloudException as e:
print(e) # will be 401 in case of Auth error