HellAmbro / Trading212API

Unofficial Trading212 API
MIT License
57 stars 27 forks source link

'Trading212' object has no attribute 'cookie' #7

Closed Phalanxguard closed 2 years ago

Phalanxguard commented 2 years ago

I've fixed some issues in the last pull request, but there is still an issue somewhere with cookies that I can't resolve. The error displays the following message shortly after successful login:

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

Phalanxguard commented 2 years ago

Adding a wait time before getting the session cookie seems to resolve the issue:

get session cookie

    time.sleep(1) #Let the cookies arrive!
    cookies = self.driver.get_cookies()
    if cookies is not None:
        for cookie in cookies: