Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 8th, 2002, 07:44 PM
jimmy2k1 jimmy2k1 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2002
Posts: 89 jimmy2k1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 48 m 50 sec
Reputation Power: 12
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

Reply With Quote
  #2  
Old August 25th, 2003, 09:10 PM
takoyaki takoyaki is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 1 takoyaki User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 37 m 40 sec
Reputation Power: 0
Lightbulb

there was a mistake:
this one works, i am using it in my webpage.

import os
os.environ.get('REMOTE_ADDR')

hope that helps

Reply With Quote
  #3  
Old August 26th, 2003, 06:32 PM
jimmy2k1 jimmy2k1 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2002
Posts: 89 jimmy2k1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 48 m 50 sec
Reputation Power: 12
wow you're a little late lol

Reply With Quote
  #4  
Old August 26th, 2003, 07:08 PM
takoyaki takoyaki is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 1 takoyaki User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 37 m 40 sec
Reputation Power: 0
Talking

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

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > getting person's ip on my server

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap