Skip to content

Commit

Permalink
Force use context
Browse files Browse the repository at this point in the history
  • Loading branch information
SeaweedbrainCY committed Dec 2, 2024
1 parent b9e262e commit eee1873
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions api/Utils/utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from app import app
import re
import html
from environment import logging
Expand Down Expand Up @@ -127,8 +128,9 @@ def test_ip(ip):
except Exception as e:
logging.error("Error while testing ip address : " + str(e))
return False
try :
remote_ip = ipaddress.ip_address(request.remote_addr)
try:
with app.app.app_context():
remote_ip = ipaddress.ip_address(request.remote_addr)
except Exception as e:
logging.error("Error while getting remote ip address : " + str(e))
return None
Expand Down

0 comments on commit eee1873

Please sign in to comment.