pep.py/helpers/requestHelper.py

7 lines
269 B
Python
Raw Normal View History

from objects import glob
def getRequestIP(bottleRequest):
realIP = bottleRequest.headers.get("X-Forwarded-For") if glob.cloudflare == True else bottleRequest.headers.get("X-Real-IP")
if realIP != None:
return realIP
return bottleRequest.environ.get("REMOTE_ADDR")