def GitHub_raise_for_status(r):
<EOL>if r.status_code == <NUM_LIT> and r.headers.get('<STR_LIT>'):<EOL><INDENT>raise GitHubError("<STR_LIT>")<EOL><DEDENT>if r.status_code == <NUM_LIT> and r.headers.get('<STR_LIT>') == '<STR_LIT:0>':<EOL><INDENT>reset = int(r.headers['<STR_LIT>'])<EOL>limit = int(r.headers['<STR_LIT>'])<EOL>reset_datetime = datetime.datetime.fromtimestamp(reset, datetime.timezone.utc)<EOL>relative_reset_datetime = reset_datetime - datetime.datetime.now(datetime.timezone.utc)<EOL>mm, ss = divmod(relative_reset_datetime.seconds, <NUM_LIT>)<EOL>hh, mm = divmod(mm, <NUM_LIT>)<EOL>def plural(n):<EOL><INDENT>return n, abs(n) != <NUM_LIT:1> and "<STR_LIT:s>" or "<STR_LIT>"<EOL><DEDENT>s = "<STR_LIT>" % plural(mm)<EOL>if hh:<EOL><INDENT>s = "<STR_LIT>" % plural(hh) + s<EOL><DEDENT>if relative_reset_datetime.days:<EOL><INDENT>s = ("<STR_LIT>" % plural(relative_reset_datetime.days)) + s<EOL><DEDENT>authenticated = limit >= <NUM_LIT:100><EOL>message = """<STR_LIT>"""<EOL>
Call instead of r.raise_for_status() for GitHub requests

Checks for common GitHub response issues and prints messages for them.