N4S4 / synology-api

A Python wrapper around Synology API
MIT License
384 stars 142 forks source link

TypeError: __init__() got an unexpected keyword argument 'dsm_version' #95

Closed cwbsl closed 2 years ago

cwbsl commented 2 years ago

We've had the project working greatly and now enabled 2FA on our Synology. I updated the library (We were using one which is older than 2 years) and now I get the error:

TypeError: init() got an unexpected keyword argument 'dsm_version'

What am I doing wrong?

N4S4 commented 2 years ago

Could you please post the the initialization line? The new releases requires to specify if you use dsm 6 or 7

cwbsl commented 2 years ago

Yes sorry!

f2 = sys_info.SysInfo(str(server), '5001', 'administratoruser', 'MyPassword!', secure=True, cert_verify=True, dsm_version=7, otp_code=483520 )

How does the otp code work exactly?

N4S4 commented 2 years ago

sys_info is now core_sys_info try to change the module name to core_sys_info.SysInfo

N4S4 commented 2 years ago

Any luck?

cwbsl commented 2 years ago

Sorry for my late response! We were moving and I didn't have time to look at it. It worked! Thanks a lot! The only problem now is with the otp code... How do I correctly use it?

N4S4 commented 2 years ago

I close the issue as it has been fixed. Regarding the otp code i do not use it but i guess you will need to request it in another istance. Maybe @liuerfire might give better instructions about it? So i can update also the readme file

liuerfire commented 2 years ago

OTP code will be needed when 2-Factor Authentication is enabled. image

In general, you can use other tools (e.g. https://www.nongnu.org/oath-toolkit/man-oathtool.html) to generate the code.

cwbsl commented 2 years ago

Thanks for your help! Yes, I have 2FA enabled on all my 4 Synology devices. So I will have to find a way to generate the code in Ruby (As my current project is in Ruby) so i can send it with my requests. Thanks!

Edit: It worked!