Note that there are some explanatory texts on larger screens.

plurals
  1. POTwitter search api blocked from Amazon EC2 in Ruby only, not curl...is this Net::HTTP?
    text
    copied!<p>This is a weird one that anyone can repro at home (I think) - I am trying to write a simple service to run searches on Twitter on a service hosted on EC2. Twitter returns me errors 100% of the time when run in ruby, but not in other languages, which would indicate it's not an IP-blocking issue. Here is an example:</p> <pre><code>admin@ec2-xx-101-152-xxx-production:~$ irb irb(main):001:0&gt; require 'net/http' =&gt; true irb(main):002:0&gt; res = Net::HTTP.post_form(URI.parse('http://search.twitter.com/search.json'), {'q' =&gt; 'twitter'}) =&gt; #&lt;Net::HTTPBadRequest 400 Bad Request readbody=true&gt; irb(main):003:0&gt; exit admin@ec2-xx-101-152-xxx-production:~$ curl http://search.twitter.com/search.json?q=twitter {"results":[{"text":"&amp;quot;Social Media and SE(Search Engine) come side by side to help promote your business and bran...&lt;snip/&gt; </code></pre> <p>As you see, CURL works, irb does not. When I run on my local windows box in irb, success:</p> <pre><code>$ irb irb(main):001:0&gt; require 'net/http' =&gt; true irb(main):002:0&gt; res = Net::HTTP.post_form(URI.parse('http://search.twitter.com/search.json'), {'q' =&gt; 'twitter'}) =&gt; #&lt;Net::HTTPOK 200 OK readbody=true&gt; </code></pre> <p>This is confusing...if there was some kind of core bug in Net::HTTP, I would think it would show up both on windows and linux, and if I was being blocked by my IP, then curl shouldn't work either. I tried this on a fresh Amazon instance too with a fresh IP addy. </p> <p>Anyone should be able to repro this 'cause I'm using the ec2onrails ami: </p> <pre><code>ec2-run-instances ami-5394733a -k testkeypair </code></pre> <p>Just ssh in after that and run those simple lines above. Anyone have ideas what's going on? </p> <p>Thanks!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload