

def statuses(twitter, screen_name, tweets, mentions=False, favorites=False, received_dms=None, isoformat=False):
    'Get all the statuses for a screen name.'
    max_id = None
    fail = Fail()
    while True:
        try:
            portion = statuses_portion(twitter, screen_name, max_id, mentions, favorites, received_dms, isoformat)
        except TwitterError as e:
            if (e.e.code == 401):
                err(('Fail: %i Unauthorized (tweets of that user are protected)' % e.e.code))
                break
            elif (e.e.code == 429):
                err(('Fail: %i API rate limit exceeded' % e.e.code))
                rls = twitter.application.rate_limit_status()
                reset = rls.rate_limit_reset
                reset = _time.asctime(_time.localtime(reset))
                delay = (int((rls.rate_limit_reset - _time.time())) + 5)
                err(('Interval limit of %i requests reached, next reset on %s: going to sleep for %i secs' % (rls.rate_limit_limit, reset, portion)))
                fail.wait(delay)
                continue
            elif (e.e.code == 404):
                err(('Fail: %i This profile does not exist' % e.e.code))
                break
            elif (e.e.code == 502):
                err(('Fail: %i Service currently unavailable, retrying...' % e.e.code))
            else:
                err(('Fail: %s\nRetrying...' % str(e)[:500]))
            fail.wait(3)
        except urllib2.URLError as e:
            err(('Fail: urllib2.URLError %s - Retrying...' % str(e)))
            fail.wait(3)
        except httplib.error as e:
            err(('Fail: httplib.error %s - Retrying...' % str(e)))
            fail.wait(3)
        except KeyError as e:
            err(('Fail: KeyError %s - Retrying...' % str(e)))
            fail.wait(3)
        else:
            new = (- len(tweets))
            tweets.update(portion)
            new += len(tweets)
            err(('Browsing %s statuses, new tweets: %i' % ((screen_name if screen_name else 'home'), new)))
            if (new < 190):
                break
            max_id = (min(portion.keys()) - 1)
            fail = Fail()

dataset/ETHPy150Open sixohsix/twitter/twitter/archiver.py statuses/VarMisuse@196/331 `delay`->`portion`