Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[paypal] base64 decode payload containing CSRF token #98

Merged
merged 1 commit into from
Sep 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading