The whole process pissed me off so much that I want to share a my script to get the pickle file. Maybe read and tried 8 things from forum posts 4 years ago; I almost went insane because I've never really dealt with non-user friendly OAUTH stuff (robin-stocks was what I was using before this until I learned how bad the fills were). This will save the api newbies like ~5hrs of documentation and forum reading because of how TDA does the complicated redirect thing for platform apps.
from urllib.request import urlopen
API_KEY = "your key here"
REDIRECT_URI = 'https://127.0.0.1'
TOKEN_PATH = 'token.pickle'
# Import selenium here because it's slow to import
from selenium import webdriver
driver = webdriver.Chrome()
client = tda.auth.easy_client(
Submitted August 28, 2020 at 10:59AM by getpuh