Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to POST a json-formatted request? #198

Open
cheery opened this issue Oct 2, 2015 · 1 comment
Open

How to POST a json-formatted request? #198

cheery opened this issue Oct 2, 2015 · 1 comment

Comments

@cheery
Copy link

cheery commented Oct 2, 2015

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.
@jaitaiwan
Copy link
Contributor

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.

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

No branches or pull requests

3 participants