Skip to content

Instantly share code, notes, and snippets.

@studiomaestro
Created October 27, 2012 13:29
Show Gist options
  • Save studiomaestro/3964619 to your computer and use it in GitHub Desktop.
Save studiomaestro/3964619 to your computer and use it in GitHub Desktop.
コケる (HTTP/1.1 411 Length Required)
tweepy.update_status('hello')
Accept-Encoding: identity
Host: api.twitter.com
Authorization: OAuth realm="", oauth_nonce="0000000000", oauth_timestamp="1351341634", oauth_consumer_key="XXXXXXXXXX", oauth_signature_method="HMAC-SHA1", oauth_version="1.0", oauth_token="YYYYYYYYYY", oauth_signature="ZZZZZZZZZZ"
通る
tweepy.update_status('hello',headers={'Content-Length':0})
Accept-Encoding: identity
Content-Length: 0
Host: api.twitter.com
Authorization: OAuth realm="", oauth_nonce="0000000000", oauth_timestamp="1351341661", oauth_consumer_key="XXXXXXXXXX", oauth_signature_method="HMAC-SHA1", oauth_version="1.0", oauth_token="YYYYYYYYYY", oauth_signature="ZZZZZZZZZZ"
通る
twython.updateStatus(status='hello')
Accept-Encoding: gzip, deflate, compress
Accept: */*
User-Agent: Twython v2.4.0
Cookie:
Content-Type: application/x-www-form-urlencoded
Authorization: OAuth oauth_nonce="000000000000000000000000000000", oauth_timestamp="1351342624", oauth_version="1.0", oauth_signature_method="HMAC-SHA1", oauth_consumer_key="XXXXXXXXXX", oauth_token="YYYYYYYYYY", oauth_signature="ZZZZZZZZZZ"
@studiomaestro
Copy link
Author

ヘッダの違いじゃなくて本体の送り方の違いだった

tweepy
POST /1/statuses/update.json?status=hello

twython
POST /1/statuses/update.json (helloはBODYで送る)

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