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

wb.refresh_login() is returning 403 #445

Open
39xdgy opened this issue Dec 11, 2024 · 0 comments
Open

wb.refresh_login() is returning 403 #445

39xdgy opened this issue Dec 11, 2024 · 0 comments

Comments

@39xdgy
Copy link

39xdgy commented Dec 11, 2024

I am be able to login by using the did along with access token+refresh token (yes for me it would only work if I use method 1 AND method 2 at the same time). But Right now I am having an issue when I try to refresh the login by using wb.refreshing_login. When I look into the package source code, I am getting a 403 from the response without any json payload. If anyone seeing any similar issue please let me know on what the fix might be. Or we just have to reset manually every week. Thank you. Here are some of my code.

def login_wb(wb):
    wb_json = {}
    with open("Data/wb_login.json", "r") as f:
        wb_json = json.load(f)
    wb._did = wb_json["did"]
    #print(wb._did)
    wb._access_token = wb_json["accessToken"]
    wb._refresh_token = wb_json['refreshToken']
    wb._token_expire = wb_json['tokenExpireTime']
    wb._uuid = wb_json['uuid']
    #print(wb._account_id)
    print(wb.get_trade_token(password=wb_json["trade_token"]))
    wb.login(wb_json["phone"], wb_json["password"])

    #print(wb._account_id)
    return wb

def reset_login(wb):
    n_data = wb.refresh_login()
    wb_json = {}
    with open("Data/wb_login.json", "r") as f:
        wb_json = json.load(f)

    print(n_data)
    wb_json['accessToken'] = n_data['accessToken']
    wb_json['refreshToken'] = n_data['refreshToken']
    wb_json['tokenExpireTime'] = n_data['tokenExpireTime']

    file = open('Data/wb_login.json', 'w')
    json.dump(credential_data, file)
    file.close()

wb = webull()
wb = login_wb(wb)
#refresh_login(wb)
wb.refresh_login()

ERROR: File "/Users/jason/Desktop/git/stock_analysier/Run/golden_death_auto_trade.py", line 112, in
wb.refresh_login()
File "/Users/jason/Library/Python/3.9/lib/python/site-packages/webull/webull.py", line 281, in refresh_login
result = response.json()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant