python-oauth2 icon indicating copy to clipboard operation
python-oauth2 copied to clipboard

How to POST a json-formatted request?

Open cheery opened this issue 10 years ago • 1 comments
trafficstars

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.

cheery avatar Oct 02 '15 18:10 cheery

We've moved documentation on how to do twitter calls into the Wiki. I'm not sure if @rickhanlonii has updated yet so I appologise if its out of date.

jaitaiwan avatar Nov 18 '15 08:11 jaitaiwan