<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>140dev &#187; Twitter Server Errors</title>
	<atom:link href="http://140dev.com/twitter-api-programming-blog/category/twitter-server-errors/feed/" rel="self" type="application/rss+xml" />
	<link>http://140dev.com</link>
	<description>Twitter API Programming Tips, Tutorials, Source Code Libraries and Consulting</description>
	<lastBuildDate>Wed, 31 Jul 2019 10:03:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.6</generator>
		<item>
		<title>Overcoming 502 errrors while backfilling tweets</title>
		<link>http://140dev.com/twitter-api-programming-blog/overcoming-502-errrors-while-backfilling-tweets/</link>
		<comments>http://140dev.com/twitter-api-programming-blog/overcoming-502-errrors-while-backfilling-tweets/#comments</comments>
		<pubDate>Fri, 04 Feb 2011 13:15:55 +0000</pubDate>
		<dc:creator>Adam Green</dc:creator>
				<category><![CDATA[Rate Limits]]></category>
		<category><![CDATA[Streaming API]]></category>
		<category><![CDATA[Twitter Politics]]></category>
		<category><![CDATA[Twitter Server Errors]]></category>
		<category><![CDATA[2012 candidates]]></category>

		<guid isPermaLink="false">http://140dev.com/?p=1178</guid>
		<description><![CDATA[I&#8217;m collecting all the tweets for possible 2012 candidates with the Streaming API, and I wanted to make sure I was getting every one of their tweets. I built a backfilling script to go through every tweet in each of these accounts, and add any that weren&#8217;t already in the database. This uses the /statuses/user_timeline [&#8230;]]]></description>
				<content:encoded><![CDATA[<p></p><p>I&#8217;m collecting all the tweets for possible 2012 candidates with the Streaming API, and I wanted to make sure I was getting every one of their tweets. I built a backfilling script to go through every tweet in each of these accounts, and add any that weren&#8217;t already in the database. This uses the <a href="http://dev.twitter.com/doc/get/statuses/user_timeline">/statuses/user_timeline</a> call to get the past tweets. I ran into a problem with tons of 502 errors from the Twitter API, as many as one every two or three API calls. </p>
<p>Taylor Singletary on the Dev mailing list suggested dropping the count parameter to avoid timeout errors, and this has helped a lot. I was using a count of 200 tweets per call to keep the number of calls low. This gave me all the data in about 100 calls, but with the errors I wasn&#8217;t able to complete the process before hitting the rate limit. I tried dropping the count to 100, and this allowed the script to finish with a total of 298 calls. </p>
<p>So now I have the catch 22 of needing to do more API calls to avoid the errors that cause too many API calls. The only solution I see is to cut the count parameter to a level that is low enough to avoid errors, and then spread the backfilling out over multiple hours to stay within the rate limit. </p>
<p>I think the ultimate solution is to do a steady level of backfilling spread over the entire day. I haven&#8217;t had to do backfilling in the past, because I was treating the Streaming API tweet collection as a high volume sampling mechanism. As long as I got lots of tweets on a particular subject, it was good. Now that I want to maintain a database of every tweet made by the candidates I have to backfill to make sure nothing was missed by streaming. This seems to be necessary, since every time I run the backfill I get two to three tweets that didn&#8217;t get sent by streaming. </p>
]]></content:encoded>
			<wfw:commentRss>http://140dev.com/twitter-api-programming-blog/overcoming-502-errrors-while-backfilling-tweets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
