Thiloid commited on
Commit
f76517a
·
verified ·
1 Parent(s): b518cbb

Update run.py

Browse files
Files changed (1) hide show
  1. run.py +6 -5
run.py CHANGED
@@ -10,12 +10,13 @@ from google.oauth2 import service_account
10
 
11
  import socket
12
 
13
- def get_local_ip():
14
  """Get the local IP address."""
15
- hostname = socket.gethostname()
16
- local_ip = socket.gethostbyname(hostname)
17
- print("IP______________________")
18
- print(local_ip)
 
19
  return local_ip
20
  val=get_local_ip()
21
  # Google Sheets setup
 
10
 
11
  import socket
12
 
13
+ def get_local_ip(request: gr.Request):
14
  """Get the local IP address."""
15
+ client_ip = request.client.host
16
+ local_ip = socket.gethostbyname(socket.gethostbyname(""))
17
+ x_forwarded_for = request.headers.get('x-forwarded-for')
18
+ print("client_ip", client_ip, text)
19
+ print("x_forwarded_for", x_forwarded_for)
20
  return local_ip
21
  val=get_local_ip()
22
  # Google Sheets setup