Closed jashanj0tsingh closed 1 year ago
Hi Thank you for reporting Actually it is not an expected behaviour. Does happen the same with get_config()? So if you set secure=True does not happen?
From your output seems like did not get the api list while logging in...strange
With http
User logged in, new session started!
User logged in, new session started!
Traceback (most recent call last):
File "/usr/local/src/test.py", line 13, in
Seems like it's the same issue with get_config()
With https
When I set secure to True then I get the folowing error
Traceback (most recent call last): File "/usr/local/lib/python3.10/dist-packages/urllib3/connectionpool.py", line 699, in urlopen httplib_response = self._make_request( File "/usr/local/lib/python3.10/dist-packages/urllib3/connectionpool.py", line 382, in _make_request self._validate_conn(conn) File "/usr/local/lib/python3.10/dist-packages/urllib3/connectionpool.py", line 1010, in _validate_conn conn.connect() File "/usr/local/lib/python3.10/dist-packages/urllib3/connection.py", line 411, in connect self.sock = ssl_wrapsocket( File "/usr/local/lib/python3.10/dist-packages/urllib3/util/ssl.py", line 432, in ssl_wrap_socket ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_intls) File "/usr/local/lib/python3.10/dist-packages/urllib3/util/ssl.py", line 474, in _ssl_wrap_socket_impl return ssl_context.wrap_socket(sock) File "/usr/lib/python3.10/ssl.py", line 513, in wrap_socket return self.sslsocket_class._create( File "/usr/lib/python3.10/ssl.py", line 1071, in _create self.do_handshake() File "/usr/lib/python3.10/ssl.py", line 1342, in do_handshake self._sslobj.do_handshake() ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:997)
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/lib/python3.10/dist-packages/requests-2.28.2-py3.10.egg/requests/adapters.py", line 489, in send resp = conn.urlopen( File "/usr/local/lib/python3.10/dist-packages/urllib3/connectionpool.py", line 755, in urlopen retries = retries.increment( File "/usr/local/lib/python3.10/dist-packages/urllib3/util/retry.py", line 574, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='10.x.x.10', port=5000): Max retries exceeded with url: /webapi/auth.cgi?api=SYNO.API.Auth&version=7&method=login&account=adminuser&passwd=password&session=FileStation&format=cookie (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:997)')))
Also, same issue with Python 3.6.x
root@545491ad573b:/usr/local/src# python test.py
User logged in, new session started!
User logged in, new session started!
Traceback (most recent call last):
File "test.py", line 9, in
What DSM version do you have on your NAS? Are you actually using only http or https? Any opt code?
DSM 7.1.1-42962 Update 1
Using only http for now, just got started with your API, will eventually switch to https which depends on how well this API could fit in our design :)
For now I did make FileStation work, by updating some of the paths in auth.py
Ok i see....it is very strange, so even filestation did not work for you, I guess the entire api than
ok so i tested on my synology and looks like is working and receiving data from http request without any modification, I wanted to ask did you set the port correctly while initiating the function? (5000, or whatever u set as http) Did you set automatic redirection to https? not sure if is an isolated case for you, to be sure it should be tested with more I am using DSM 7 Update 4
Thats a bit strange to hear for me as well, last I checked on the PDFs available for DSM Login API, in the docs they are using entry.cgi
path, and yes if you look closely at the error logs I pasted above, I am using the 5000 port, and no I am not doing anything special, simply using the sample http example as is from the README.md
I see the last bit of error was
HTTPSConnectionPool(host='10.x.x.10', port=5000): Max retries exceeded with url: /webapi/auth.cgi?api=SYNO.API.Auth&version=7&method=login&account=adminuser&passwd=password&session=FileStation&format=cookie (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:997)')))
It looks the request was made with secure =True
Can you post the bit of code where you initiate the class? Omitting sensitive data of course
Yes, you are right, I did both tests... I updated the comment to show http vs https outputs. You may take another glance if you'd like :)
and, sure like I said I am just using the same example code from README.md
from synology_api import filestation, downloadstation
fl = filestation.FileStation('10.x.x.10', '5000', 'user', 'password', secure=False, cert_verify=False, dsm_version=7, debug=True, otp_code=None)
fl.get_info()
dwn = downloadstation.DownloadStation('10.x.x.10', '5000', 'user', 'password', secure=False, cert_verify=False, dsm_version=7, debug=True, otp_code=None)
dwn.get_info()
so, this doesn't work for me out of the box and it simply returns,
User logged in, new session started!
User logged in, new session started!
Traceback (most recent call last):
File "/usr/local/src/test.py", line 9, in
dwn.get_info()
File "/usr/local/src/synology_api/downloadstation.py", line 26, in get_info
info = self.download_list[api_name]
KeyError: 'SYNO.DownloadStation.Info'
I been asking other users they do not experience the same, not sure what us going on Also strange output for the code, you should have 'User logged in,.....' Than fl.get_info() output instead of both logins
Closed due to inactivity
Hi,
The Basic Usage Http example gives the following error, before I start digging deeper, I wanted to know if this is the expected behavior?
User logged in, new session started! User logged in, new session started! Traceback (most recent call last): File "/usr/local/src/test.py", line 9, in
dwn.get_info()
File "/usr/local/src/synology_api/downloadstation.py", line 26, in get_info
info = self.download_list[api_name]
KeyError: 'SYNO.DownloadStation.Info'