HellAmbro / Trading212API

Unofficial Trading212 API
MIT License
57 stars 27 forks source link

AttributeError: 'Trading212' object has no attribute 'cookie' #9

Closed Phalanxguard closed 2 years ago

Phalanxguard commented 2 years ago

Downloaded the latest code from the repo, seems like it's having issues getting the session cookie, this had also happened in the previous revision occasionally, but now it seems to be persistent.

trading212 = Trading212(email, password, driver, mode=Mode.DEMO, trading=Trading.CFD) File "C:\Python310\lib\site-packages\pytrading212\trading212.py", line 115, in init "Cookie": self.cookie, AttributeError: 'Trading212' object has no attribute 'cookie'

HellAmbro commented 2 years ago

I just tested the code and it seems to be working, try to see the content of the cookie.

if cookie['name'] == self.session: self.cookie = f"{self.session}={cookie['value']};" the error is related to this line of code, unfortunately there is no session name entry in your cookies. Also try to see the value of self.session .