Qluxzz / avanza

A Python library for the unofficial Avanza API
https://qluxzz.github.io/avanza/
MIT License
85 stars 40 forks source link

Help needed #22

Closed GentoGaming closed 2 months ago

GentoGaming commented 3 years ago

I dont know why i am getting this error , can anyone tell me how to fix ? self._authentication_session = response_body['authenticationSession'] KeyError: 'authenticationSession'

Qluxzz commented 3 years ago

Have you followed the guide in the README and tried out the first example snippet? Do you still get the same error then?

GentoGaming commented 3 years ago

This : import hashlib import pyotp totp = pyotp.TOTP('MY_TOTP_SECRET', digest=hashlib.sha1) print(totp.now()) Worked and gave me the code

GentoGaming commented 3 years ago

from avanza import Avanza avanza = Avanza({ 'username': 'MY_USERNAME', 'password': 'MY_PASSWORD', 'totpSecret': 'MY_TOTP_SECRET' })

overview = avanza.get_overview()

This didnt work . self._authentication_session = response_body['authenticationSession'] KeyError: 'authenticationSession'

Qluxzz commented 3 years ago

And logging into Avanza directly on their website using your username and password and totp-code works? image

vonDassendorf commented 3 years ago

Just to clarify you should give the Avanza class the secret (that you get from avanza when enabling 2fa) that is used to generate the totp code and not the code generated by pyotp.