Giter VIP home page Giter VIP logo

Comments (12)

N4S4 avatar N4S4 commented on June 21, 2024

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

from synology-api.

jashanj0tsingh avatar jashanj0tsingh commented on June 21, 2024

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
dwn.get_config()
File "/usr/local/src/synology_api/downloadstation.py", line 34, in get_config
info = self.download_list[api_name]
KeyError: 'SYNO.DownloadStation.Info'

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_wrap_socket(
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_in_tls)
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)')))

from synology-api.

jashanj0tsingh avatar jashanj0tsingh commented on June 21, 2024

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
dwn.get_info()
File "/root/.pyenv/versions/3.6.0/lib/python3.6/site-packages/synology_api/downloadstation.py", line 26, in get_info
info = self.download_list[api_name]
KeyError: 'SYNO.DownloadStation.Info'

from synology-api.

N4S4 avatar N4S4 commented on June 21, 2024

What DSM version do you have on your NAS?
Are you actually using only http or https? Any opt code?

from synology-api.

jashanj0tsingh avatar jashanj0tsingh commented on June 21, 2024

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

image

from synology-api.

N4S4 avatar N4S4 commented on June 21, 2024

Ok i see....it is very strange, so even filestation did not work for you, I guess the entire api than

from synology-api.

N4S4 avatar N4S4 commented on June 21, 2024

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

from synology-api.

jashanj0tsingh avatar jashanj0tsingh commented on June 21, 2024

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

image

from synology-api.

N4S4 avatar N4S4 commented on June 21, 2024

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

from synology-api.

jashanj0tsingh avatar jashanj0tsingh commented on June 21, 2024

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'

from synology-api.

N4S4 avatar N4S4 commented on June 21, 2024

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

from synology-api.

N4S4 avatar N4S4 commented on June 21, 2024

Closed due to inactivity

from synology-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.