Skip to content

Commit

Permalink
[paypal] base64 decode payload containing CSRF token
Browse files Browse the repository at this point in the history
  • Loading branch information
moritzj29 committed May 19, 2024
1 parent a87f8f7 commit 25b1559
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion finance_dl/paypal.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import datetime
import os
import time
import base64
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import Select
from selenium.webdriver.common.keys import Keys
Expand Down Expand Up @@ -176,7 +177,8 @@ def get_csrf_token(self):
self.driver.get('https://www.paypal.com/myaccount/transactions/')
# Get CSRF token
body_element, = self.wait_and_locate((By.ID, "__APP_DATA__"))
attribute_object = json.loads(body_element.get_attribute("innerHTML"))
data = base64.b64decode(body_element.get_attribute("innerHTML"))
attribute_object = json.loads(data)
self.csrf_token = attribute_object["_csrf"]
return self.csrf_token

Expand Down

0 comments on commit 25b1559

Please sign in to comment.