Skip to content

Commit

Permalink
Adding in extra robustness for make_twitter_request
Browse files Browse the repository at this point in the history
  • Loading branch information
ptwobrussell committed Dec 1, 2013
1 parent 18de9f5 commit 047e40d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ipynb/Chapter 9 - Twitter Cookbook.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -895,12 +895,16 @@
" return\n",
" except URLError, e:\n",
" error_count += 1\n",
" time.sleep(wait_period)\n",
" wait_period *= 1.5\n",
" print >> sys.stderr, \"URLError encountered. Continuing.\"\n",
" if error_count > max_errors:\n",
" print >> sys.stderr, \"Too many consecutive errors...bailing out.\"\n",
" raise\n",
" except BadStatusLine, e:\n",
" error_count += 1\n",
" time.sleep(wait_period)\n",
" wait_period *= 1.5\n",
" print >> sys.stderr, \"BadStatusLine encountered. Continuing.\"\n",
" if error_count > max_errors:\n",
" print >> sys.stderr, \"Too many consecutive errors...bailing out.\"\n",
Expand Down Expand Up @@ -1538,4 +1542,4 @@
"metadata": {}
}
]
}
}

0 comments on commit 047e40d

Please sign in to comment.