|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
getting person's ip on my server
Hello, I am using mod_python+Spyce on my server for my html pages, anyway what I wanna do is show the person's ip address so it can say something like "your ip address is: xxx.xxx.xxx.xxx" someone suggested this code:
Code:
import os os.environ["REMOTE_ADDR"] but it gives me this error: Code:
Spyce exception File: c:/program files/apache group/apache/htdocs/server/main.spy Message: KeyError: REMOTE_ADDR Stack: main.spy:80, in (main): print os.environ["REMOTE_ADDR"] C:\PROGRAM FILES\PYTHON\lib\os.py:387, in __getitem__: return self.data[key.upper()] basicly what I am looking for is the python equivalent for <?php echo getenv("REMOTE_ADDR"); ?> thanks |
|
#2
|
|||
|
|||
|
there was a mistake:
this one works, i am using it in my webpage. import os os.environ.get('REMOTE_ADDR') hope that helps |
|
#3
|
|||
|
|||
|
wow you're a little late lol
|
|
#4
|
|||
|
|||
|
oops
haha .. i didnt even check the date.. i was trying to do the same thing and was looking for answers from google., and i saw your post.. so i replied.. lol i guess u have figured it out long time ago eh? u should've posted the soln back up ![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > getting person's ip on my server |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|