-
-
Notifications
You must be signed in to change notification settings - Fork 180
Description
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()