This is the error that I am getting. I have wrapped the code with the retry
logic but of not much help. It shows a HTTP 502 Bad gateway error and also
somewhere in between says
<h2>Twitter is over capacity.</h2>
<p>Too many tweets! Please wait a moment and try again.</p>
I have been getting this error for more than three weeks now.
HTTP/1.1 502 Bad Gateway
Date: Tue, 10 Nov 2009 05:44:50 GMT
Server: Apache
Last-Modified: Wed, 28 Oct 2009 11:02:57 GMT
Accept-Ranges: bytes
Content-Length: 4729
Vary: Accept-Encoding
Connection: close
Content-Type: text/html; charset=UTF-8
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="en-us" />
<title>Twitter / Over capacity</title>
<link href="http://s.twimg.com/images/favicon.ico" rel="shortcut icon"
type="image/x-icon" />
<style type="text/css">
/* Page
----------------------------------------------- */
* { border: 0; padding: 0; margin: 0; }
body{ margin: 10px 0; background:#C0DEED url(
http://s.twimg.com/images/bg-clouds.png) repeat-x; color:#333; font: 12px
Lucida Grande, Arial, sans-serif; text-align:center }
#container { width: 755px; margin: 0 auto; padding: 0px 0; text-align:
left; position: relative; }
#content { width: 100%; margin-top: 0px; float: left; margin-top: 8px;
padding-bottom: 15px; background: transparent url(
http://s.twimg.com/images/arr2.gif) no-repeat scroll 25px 0px;}
.subpage #content .wrapper { background-color: #fff; padding: 10px
0px 10px 0px; -moz-border-radius: 5px 5px 0 0; -webkit-border-radius: 5px;
-webkit-border-bottom-left-radius: 0px; -webkit-border-bottom-right-radius:
0px;}
.subpage #content h2 { margin: 5px 20px; font: bold 26px Helvetica
Neue, Helvetica, Arial, sans-serif; }
.subpage #content p { margin: 0 20px 10px 20px; color: #666;
font-size: 13px;}
.subpage #content ul { padding-left: 30px; }
.subpage #content ol, #side ol { padding-left: 30px; }
a{text-decoration:none;color: #0084b4;}
#content div.desc { margin: 11px 0px 10px 0px; }
a img{border:0;}
ul{list-style:square;padding-left:20px;}
div.error { width: 100%; text-align: center; margin: 0px 0;}
/* Navigation
----------------------------------------------- */
#navigation { background-color: #fff; position: absolute; top: 8px;
right: 0; padding: 6px 6px; font-size: 13px; text-align: center; }
#navigation ul { margin: 0; padding: 0px; width: auto; height: 100%;
_width: 60px;}
#navigation li { display:inline; padding: 0 5px; }
#navigation li:before { content: ' '; padding-right: 0; }
#navigation li.first:before { content: ''; padding-right: 0; }
#navigation, #footer { -moz-border-radius: 5px;-webkit-border-radius:
5px;}
/* Footer
----------------------------------------------- */
#footer { clear: left; width: 555px; text-align: left; padding: 0px 0;
font-size: 11px; color: #778899;}
#footer ul { clear: both; display: block;}
#footer li { display: block; float: left; margin: 0 16px 0 0;}
#footer li.first:before { content: ''; padding-right: 0; }
</style>
</head>
<body>
<div id="container" class="subpage">
<div id="navigation">
<ul>
<li class="first"><a href="http://twitter.com">Home
›</a></li>
</ul>
</div>
<h1 id="header"><a href="http://twitter.com"><img src="
http://s.twimg.com/images/twitter_logo_header.png" width="155" height="36"
/></a></h1>
<div id="content">
<div class="desc"></div>
<div class="wrapper">
<h2>Twitter is over capacity.</h2>
<p>Too many tweets! Please wait a moment and try again.</p>
</div>
<div class="error"><img src="
http://s.twimg.com/images/whale_error.gif" /></div>
</div>
<div id="footer" style="width:100%">
<ul>
<li class="first">© 2009 Twitter</li>
<li><a href="/help/aboutus">About Us</a></li>
<li><a href="/help/contact">Contact</a></li>
<li><a href="http://blog.twitter.com/">Blog</a></li>
<li><a href="http://status.twitter.com/">Status</a></li>
<li><a href="/help/api">API</a></li>
<li><a href="http://help.twitter.com/">Help</a></li>
<li><a href="/help/jobs">Jobs</a></li>
<li><a href="/help/tos">TOS</a></li>
<li><a href="/help/privacy">Privacy</a></li>
On Thu, Oct 29, 2009 at 10:08 PM, hima latha <[email protected]> wrote:
> I am able to ping and traceroute to twitter.com so I am guessing the error
> is not because of the IP. Can you suggest any solutions to my problem?
>
>
> On Thu, Oct 29, 2009 at 8:49 PM, Chad Etzel <[email protected]> wrote:
>
>>
>> If you are getting a response from the servers (even error codes) then
>> you are not blocked. A blacklisted IP looks like it goes into a
>> blackhole and no data is returned, ever.
>>
>> Are you able to ping and traceroute to twitter.com?
>>
>> -Chad
>>
>> On Thu, Oct 29, 2009 at 2:11 PM, hima latha <[email protected]> wrote:
>> > I tried running the code on every other day for like a week now. I tried
>> it
>> > continusly but it is not working anymore. Has this got to do with any Ip
>> > addresses being blocked? To confirm this, I tried running the code on
>> > different computers but with no success.
>> >
>> > On Thu, Oct 29, 2009 at 12:53 PM, Adam Green <[email protected]>
>> wrote:
>> >>
>> >> I'm also getting intermittent 502 errors, so I don't think this is
>> >> code specific. I am calling the search API and getting a 502 error
>> >> every couple of hours. The vast majority of API calls are working.
>> >> Repeating the call after a 502 error generally works.
>> >>
>> >> On Oct 29, 11:41 am, hima <[email protected]> wrote:
>> >> > Hi
>> >> > I am trying to collect users data from twitter, like the number of
>> >> > followers, number of tweets, the time the user' account is alive and
>> >> > similar statistics. I have done this before in august and got
>> >> > appropriate results with my code.I ran the code again a week ago and
>> >> > it worked and gave me results. The same code however, stopped working
>> >> > since a week now responding with a 502 bad gateway error. I am not
>> >> > able to connect to the twitter page and get the xml body. This is my
>> >> > function to return the xml page:
>> >> >
>> >> > public static String webget(String host, String doc, String username,
>> >> > String password)
>> >> > {
>> >> > String body = "";
>> >> > byte[] auth = Base64.decode(username + ":" + password
>> );
>> >> > String header = "Get " + doc + " HTTP/1.0\r\n";
>> >> > header += "Authorization: Basic " + auth ;
>> >> > header += "Accept: application/xml, text/plain,
>> >> > text/xml, text/*\r
>> >> > \n";
>> >> > header += "\r\n";
>> >> >
>> >> > try
>> >> > {
>> >> > Socket sock = new Socket(host, 80);
>> >> > OutputStreamWriter os = new
>> >> > OutputStreamWriter(sock.getOutputStream
>> >> > ());
>> >> > os.write(header);
>> >> > os.flush();
>> >> > sock.getOutputStream().flush();
>> >> >
>> >> > BufferedReader br = new BufferedReader(new
>> >> > InputStreamReader(sock.getInputStream()));
>> >> > String str = null;
>> >> > while ( (str = br.readLine()) != null)
>> >> > {
>> >> > body += str + "\n";
>> >> > }
>> >> > sock.close();
>> >> > }
>> >> > catch(IOException ioe)
>> >> > {
>> >> > return "";
>> >> > }
>> >> >
>> >> > return body;
>> >> > }
>> >> >
>> >> > This function is called like this:
>> >> >
>> >> > webget("twitter.com", "/users/show/"+UserId+".xml", USERNAME,
>> >> > PASSWORD)
>> >> >
>> >> > I have not made any changes to the code since august. I am guessing
>> >> > there have been changes in the twitter API which is giving me this
>> >> > error.However, nothing like this is mentioned in the forums. Can you
>> >> > let me know if there are changes in the twitter API that is causing
>> >> > this?
>> >> >
>> >> > Thanks
>> >> > Hima
>> >
>> >
>>
>
>