Skip to content

Get 400 from requests.post in send_message because parameter should be json=data, not data=data #22

Description

@mozboz

Pyhton 3.11.2 on Debian, was getting constant 400 when trying to do anything, e.g.

400 Client Error: Bad Request for url: https://graph.facebook.com/v20.0/12345678/messages

Turned out to be because the requests.post() parameter should be named json not data

i.e.

response = requests.post(
    url, json=data, headers=headers, timeout=10
)  # 10 seconds timeout as an example

Sorry don't have time to do a PR for this :(

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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