Skip to content

How to POST a json-formatted request? #198

Open
@cheery

Description

@cheery

I'm trying to do a status update into twitter. But it responds with: {"errors":[{"code":170,"message":"Missing required parameter: status."}]}

import json
import oauth2

token = oauth2.Token(
    key=access_token['oauth_token'], 
    secret=access_token['oauth_token_secret'])
client = oauth2.Client(consumer, token)

status = 'Some weird test message'
message = {"status": status}

resp, content = client.request('https://api.twitter.com/1.1/statuses/update.json', 'POST',
    body = json.dumps(message),
    headers = {'Content-Type': 'application/json'})

Here's my problems:

  • It's not apparent how to check what is actually sent.
  • This has not been documented properly anywhere.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions