File: util.py

package info (click to toggle)
flask-limiter 3.12-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,264 kB
  • sloc: python: 6,432; makefile: 165; sh: 67
file content (12 lines) | stat: -rw-r--r-- 306 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
from __future__ import annotations

from flask import request


def get_remote_address_cloudflare() -> str:
    """
    :return: the ip address for the current request from the CF-Connecting-IP header
     (or 127.0.0.1 if none found)

    """
    return request.headers["CF-Connecting-IP"] or "127.0.0.1"