b2b604a79d0823e6e52524365371c0307961bfef max Wed Jan 17 08:30:16 2024 -0800 small tweak to RR hotfix, the previous limits very extremely strict, refs #32876 diff --git src/hg/pyLib/hgLib3.py src/hg/pyLib/hgLib3.py index b865f23..76900bb 100644 --- src/hg/pyLib/hgLib3.py +++ src/hg/pyLib/hgLib3.py @@ -40,32 +40,32 @@ # another way to change this variable is by setting the URL variable "debug" to 1 verboseLevel = 0 cgiArgs = None # like in the kent tree, we keep track of whether we have already output the content-type line contentLineDone = False # show the bot delay warning message before other printing is done? doWarnBot = False # current bot delay in milliseconds botDelayMsecs = 0 # two global variables: the first is the botDelay limit after which the page is slowed down and a warning is shown # the second is the limit after which the page is not shown anymore -botDelayWarn = 800 -botDelayBlock = 1500 +botDelayWarn = 1500 +botDelayBlock = 3000 jksqlTrace = False forceUnicode = False def warn(format, *args): print (format % args) def errAbort(msg, status=None, headers = None): " show msg and abort. Like errAbort.c " printContentType(status=status, headers=headers) print(msg) exit(0) def debug(level, msg): @@ -521,31 +521,32 @@ captchaId = int(cgiString("captchaId", 0)) if captchaId!=0: captchaAnswer = cgiString("captchaAnswer", "").lower() allowedAnswers = captchaAnswers.get(captchaId, []) if captchaAnswer in allowedAnswers: millis -= 10000 if millis > (botDelayBlock/fraction): # retry-after time factor 10 is based on the example in the bottleneck help message sys.stderr.write("hgLib.py hogExit\n") printContentType(status=429, headers={"Retry-after" : str(millis / 200)}) print("") print("Too many HTTP requests and not enough delay between them.

" "Your IP has been blocked to keep this website responsive for other users. " - "Please contact genome-www@soe.ucsc.edu to unblock your IP address or solve the captcha below. We can also help you obtain the data you need without " + "Please contact genome-www@soe.ucsc.edu to unblock your IP address, especially if you were just browsing our site and are not running a bot," + "or solve the captcha below. We can help you obtain the data you need without " "web crawling.

") showCaptcha() print("") sys.exit(0) if millis > (botDelayWarn/fraction): time.sleep(millis/1000.0) doWarnBot = True # = show warning message later in printContentType() def parseRa(text): " Parse ra-style string and return as dict name -> value " import string lines = text.split("\n") data = dict() for l in lines: