webull: place_order returns 405 error
Here’s my code,
from webull import webull
wb._access_token = "XX"
print(wb.place_order("NVOS", action="BUY", quant=1))
it throws this error
Traceback (most recent call last):
File "C:\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\models.py", line 971, in json
return complexjson.loads(self.text, **kwargs)
File "C:\AppData\Local\Programs\Python\Python39\lib\json\__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "C:\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "d:\webull_handler.py", line 16, in <module>
p = wb.place_order("NVOS", action="BUY", quant=1)
File "C:\AppData\Local\Programs\Python\Python39\lib\site-packages\webull\webull.py", line 624, in place_order
return response.json()
File "C:\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\models.py", line 975, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
is there any fix to this?
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 28 (2 by maintainers)
this is the way to update your accesstoken
oh well, I got it working, I was using the wrong trade token , Now everything is working including placing order,
Thank you for the help. @ICANTFINDAUSERNAMEATALL it meant a lot to me!
https://github.com/tedchou12/webull/wiki/Workaround-for-Login-Method-2
I wrote a quick summary of the new workaround. lmk if anything is confusing.
As you said, here is my code,
Session is expiring somehow, here is the error
{'msg': 'Your session has expired, please login again.', 'traceId': 'XX', 'code': 'trade.token.expire', 'data': {'lock': xx, 'retry': -2}, 'success': False}