Skip to content

wb.login() is returning 403 #456

@apimir

Description

@apimir

Today, logging into Webull via the Python webull library started failing. The POST to the login endpoint returns HTTP 403 with a non-JSON body (or empty body), which then causes response.json() to raise JSONDecodeError.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.10/dist-packages/webull/webull.py", line 171, in login
    result = response.json()
  File "/usr/lib/python3/dist-packages/requests/models.py", line 900, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib/python3.10/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.10/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)

I have printed out the response.

response = requests.post(self._urls.login(), json=data, headers=headers, timeout=self.timeout)
print(response)
result = response.json()

It returned <Response [403]>

Changing the _did parameter did not help.

Could you check please?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions