简体   繁体   English

如何从twitter.com捕获** http响应**? (红宝石+ Twitter宝石)

[英]how can I capture **http response** from twitter.com? ( ruby + twitter gem)

I opened a question how can I capture response from twitter.com? 我提出一个问题, 如何捕捉来自twitter.com的回复? ( ruby + twitter gem) to know if my update was successful. (ruby + twitter gem)了解我的更新是否成功。 It is working fine... 工作正常...

But I would like to know how I can capture HTTP Response Codes and Errors inside my ruby code? 但是我想知道如何在ruby代码中捕获HTTP响应代码和错误

oauth = Twitter::OAuth.new('consumer token', 'consumer secret')
oauth.authorize_from_access('access token', 'access secret')

client = Twitter::Base.new(oauth)
response = client.update('Heeeyyyyoooo from Twitter Gem!')

If you use firefox with the firebug addon installed, it displays http response codes on it's "NET" tab. 如果您在安装了firebug插件的情况下使用firefox,它将在“ NET”选项卡上显示http响应代码。

Or do you need to do this from within your app? 还是您需要在应用程序中执行此操作?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM