Re: Cross-platform way to retrieve the current (Operative system) DNS server IP address in python

2010-04-24 Thread DarkBlue
On Apr 22, 4:55 pm, joamag joa...@gmail.com wrote: Does anybody know a cross platform way to retrieve the default DNS server IP address in python ? Thanks ! João import os,urllib2,re def getIpAddr(): Function for parsing external ip adress by pinging dyndns.com

Cross-platform way to retrieve the current (Operative system) DNS server IP address in python

2010-04-22 Thread joamag
Does anybody know a cross platform way to retrieve the default DNS server IP address in python ? Thanks ! João -- http://mail.python.org/mailman/listinfo/python-list

[issue3972] Add Option to Bind to a Local IP Address in httplib.py

2010-01-03 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: It seems to break at least one buildbot: == ERROR: testSourceAddress (test.test_socket.NetworkConnectionAttributesTest)

[issue3972] Add Option to Bind to a Local IP Address in httplib.py

2010-01-03 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: Ah, and I was even the one that suggested the bind to 127.0.0.1 strategy for the test :( My buildbots run in linux-vserver virtual hosts, and they way they handle localhost (127.0.0.1) is to alias it to the IP address assigned

[issue3972] Add Option to Bind to a Local IP Address in httplib.py

2010-01-03 Thread Gregory P. Smith
Gregory P. Smith g...@krypto.org added the comment: I took the easy route and remove the test of the hostname all together. The fact that the source port was used is sufficient indication that the bind call was made. -- ___ Python tracker

[issue3972] Add Option to Bind to a Local IP Address in httplib.py

2010-01-02 Thread Gregory P. Smith
Gregory P. Smith g...@krypto.org added the comment: trunk r77263 and r77264 add this feature, including documentation and tests. -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3972

[issue3972] Add Option to Bind to a Local IP Address in httplib.py

2009-12-28 Thread Greg
Greg greg.helli...@gmail.com added the comment: Did this ever happen? It seems like overkill in the non-Python sort of way to continue pointing people to over-riding classes and extending objects when such a small patch adds so powerful and useful a functionality to the library. --

[issue3972] Add Option to Bind to a Local IP Address in httplib.py

2009-12-28 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: Since Gregory didn't update the ticket, it seems likely that it hasn't happened yet. If you'd care to try the patch and report on your results, that would help the process. We'll also need unit tests and documentation updates, so patches

[issue3972] Add Option to Bind to a Local IP Address in httplib.py

2009-12-28 Thread Greg
Greg greg.helli...@gmail.com added the comment: Just looking at the indicated file in the 2.6.4 release tarball, it does not seem that it would apply cleanly. The line numbers do not apply properly anymore, though the edited lines themselves still appear to be unaffected. Without context

[issue3972] Add Option to Bind to a Local IP Address in httplib.py

2009-12-28 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: I'm not sure why this is needed in httplib. Isn't it a matter of configuring the machine's routing tables properly? -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org

[issue3972] Add Option to Bind to a Local IP Address in httplib.py

2009-12-28 Thread Greg
Greg greg.helli...@gmail.com added the comment: For my own case, I have a machine with 50 IP addresses set and I need to run a script to grab data that will randomly select one of those IP addresses to use for its outgoing connection. That's something which needs to be selected at the socket

[issue3972] Add Option to Bind to a Local IP Address in httplib.py

2009-12-28 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: For my own case, I have a machine with 50 IP addresses set and I need to run a script to grab data that will randomly select one of those IP addresses to use for its outgoing connection. That's something which needs to be selected at the

[issue3972] Add Option to Bind to a Local IP Address in httplib.py

2009-12-28 Thread R. David Murray
one or something), and some other server it talks to is using IP based security in its .htaccess file. So the client machine needs to bind to the IP address that the server machine has authorized to access the web service. This is why, for example, the ssh command has a '-b' option to specify

[issue3972] Add Option to Bind to a Local IP Address in httplib.py

2009-12-28 Thread Giampaolo Rodola'
Giampaolo Rodola' billiej...@users.sourceforge.net added the comment: In case it helps, a guy recently reported the same issue for pyftpdlib: http://code.google.com/p/pyftpdlib/issues/detail?id=123 -- ___ Python tracker rep...@bugs.python.org

[issue3972] Add Option to Bind to a Local IP Address in httplib.py

2009-12-28 Thread Eldon Ziegler
Eldon Ziegler eld...@atlanticdb.com added the comment: The patch files for Python 2.6 and a test file are in the attached tar file. Both httplib.py and socket.py need to be patched now. httplib.HTTPConnection(host[, port[, strict[, timeout]]]) becomes httplib.HTTPConnection(host[, port[,

[issue3972] Add Option to Bind to a Local IP Address in httplib.py

2009-12-28 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: If you want the maximum chance for this to get applied, it would be best to have one or a set of patch files in 'svn diff' format against trunk (see http://python.org/dev for information on how to produce such a patch, specifically section

[issue3972] Add Option to Bind to a Local IP Address in httplib.py

2009-12-28 Thread Gregory P. Smith
Gregory P. Smith g...@krypto.org added the comment: yes its a real need and yes we should support this in the standard library. no i have not had time to look at it since my comment a 14 months ago. Thanks for the updated patch Eldon! -- ___

Re: Get Cliet IP Address

2009-08-02 Thread eliasf
Fred Atkinson wrote: What is the function to obtain the client browser's IP address? Do you mean the external public IP to the Internet? When I wanted to log the dynamic IP that my ADSL connection gets, I used whatismyip.com like this: import urllib2 QUERY_URL = 'http

Re: Get Cliet IP Address

2009-08-02 Thread Piet van Oostrum
Fred Atkinson fatkin...@mishmash.com (FA) wrote: FAWhat is the function to obtain the client browser's IP FA address? You mean in a web server? The following should work (and was posted by me not long ago): from os import getenv ip = (getenv(HTTP_CLIENT_IP) or

Get Cliet IP Address

2009-08-02 Thread Fred Atkinson
What is the function to obtain the client browser's IP address? Fred -- http://mail.python.org/mailman/listinfo/python-list

Re: IP Address Function

2009-07-09 Thread Piet van Oostrum
Fred Atkinson fatkin...@mishmash.com (FA) wrote: FA On Wed, 08 Jul 2009 12:29:54 +0200, Piet van Oostrum p...@cs.uu.nl FA wrote: Something like: #! /usr/bin/env python import cgi from os import getenv print Content-type: text/html print ipaddr = (getenv(HTTP_CLIENT_IP) or

Re: IP Address Function

2009-07-09 Thread Tim Roberts
Fred Atkinson fatkin...@mishmash.com wrote: I wonder why they don't just have a function to return it instead of putting you through all of that? In CGI, EVERYTHING gets communicated through environment variables. That (and the stdin stream) is really the only option, since you get a new

Re: IP Address Function

2009-07-08 Thread Fred Atkinson
On Tue, 07 Jul 2009 22:54:03 -0300, Gabriel Genellina gagsl-...@yahoo.com.ar wrote: En Tue, 07 Jul 2009 22:45:24 -0300, Fred Atkinson fatkin...@mishmash.com escribió: Is there a Python function I can use to get the user's IP address so I can display it on his browser? There is a long

Re: IP Address Function

2009-07-08 Thread Piet van Oostrum
Fred Atkinson fatkin...@mishmash.com (FA) wrote: FA On Tue, 07 Jul 2009 22:54:03 -0300, Gabriel Genellina FA gagsl-...@yahoo.com.ar wrote: En Tue, 07 Jul 2009 22:45:24 -0300, Fred Atkinson fatkin...@mishmash.com escribió: Is there a Python function I can use to get the user's IP address

Re: IP Address Function

2009-07-08 Thread Fred Atkinson
On Wed, 08 Jul 2009 12:29:54 +0200, Piet van Oostrum p...@cs.uu.nl wrote: Something like: #! /usr/bin/env python import cgi from os import getenv print Content-type: text/html print ipaddr = (getenv(HTTP_CLIENT_IP) or getenv(HTTP_X_FORWARDED_FOR) or getenv(HTTP_X_FORWARDED_FOR) or

Re: IP Address Function

2009-07-08 Thread Nobody
to return it instead of putting you through all of that? There's no unambiguous definition of client IP, so you have to choose which definition you want. REMOTE_ADDR is set to the actual IP address from which the connection originated (from getpeername()). If the connection was made via a proxy

IP Address Function

2009-07-07 Thread Fred Atkinson
Is there a Python function I can use to get the user's IP address so I can display it on his browser? Regards, Fred -- http://mail.python.org/mailman/listinfo/python-list

Re: IP Address Function

2009-07-07 Thread Tim Harig
On 2009-07-08, Fred Atkinson fatkin...@mishmash.com wrote: Is there a Python function I can use to get the user's IP address so I can display it on his browser? If you are using CGI you can get it from the REMOTE_ADDR environmental variable. -- http://mail.python.org/mailman/listinfo

Re: IP Address Function

2009-07-07 Thread Chris Rebert
On Tue, Jul 7, 2009 at 6:45 PM, Fred Atkinsonfatkin...@mishmash.com wrote:        Is there a Python function I can use to get the user's IP address so I can display it on his browser? from socket import gethostname, gethostbyname ip = gethostbyname(gethostname()) Cheers, Chris -- http

Re: IP Address Function

2009-07-07 Thread Gabriel Genellina
En Tue, 07 Jul 2009 22:45:24 -0300, Fred Atkinson fatkin...@mishmash.com escribió: Is there a Python function I can use to get the user's IP address so I can display it on his browser? There is a long distance between Python and browser - you'll have to tell us what is in between

Help in getting the IP address of client machines

2009-05-04 Thread M Kumar
Hi, I am using pylons web framework for my server. I need to get the ip address of the client machine which made a request to the server in my python code. How can I do that, I am new to pylons and the existing server has so many applications. looking forward to get some solutions from the kind

Re: Binary IP address representation

2009-04-22 Thread Philipp Hagemeister
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 Hi Dave, I've solved this now using ipaddr. ipaddr will be in the stdlib as soon as its developers realize there are actually not one, but two proposals to fix the remaining issues waiting for their input. Anyway, since ipaddr:r68, you can do the

Re: Specifying an IP address for outbound connections?

2008-10-29 Thread Martin v. Löwis
erikcw wrote: Python seems to default to the main system IP for outbound connections (such as urllib), but I want to bind to one of my other IPs for outbound connections. Any ideas? Just use the .bind method of a socket to bind it to a specific address. If you then want to continue to use

Specifying an IP address for outbound connections?

2008-10-28 Thread erikcw
Python seems to default to the main system IP for outbound connections (such as urllib), but I want to bind to one of my other IPs for outbound connections. Any ideas? Thanks! -- http://mail.python.org/mailman/listinfo/python-list

[issue3972] Add Option to Bind to a Local IP Address in httplib.py

2008-10-02 Thread Gregory P. Smith
Gregory P. Smith [EMAIL PROTECTED] added the comment: This is useful but as its a feature we won't be able to add it until 2.7/3.1. Assigning to me to make sure it happens. Until then, the approach I suggest is to subclass httplib.HTTPConnection and HTTPSConnection to add your own variants

[issue3972] Add Option to Bind to a Local IP Address in httplib.py

2008-10-02 Thread Eldon Ziegler
Eldon Ziegler [EMAIL PROTECTED] added the comment: Sounds good. Let me know if there is anything I can do to help. Eldon On Thu, 2008-10-02 at 18:17 +, Gregory P. Smith wrote: Gregory P. Smith [EMAIL PROTECTED] added the comment: This is useful but as its a feature we won't be able to

[issue3972] Add Option to Bind to a Local IP Address in httplib.py

2008-10-02 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' [EMAIL PROTECTED]: -- nosy: +giampaolo.rodola ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3972 ___ ___ Python-bugs-list

[issue3972] Add Option to Bind to a Local IP Address in httplib.py

2008-09-26 Thread Eldon Ziegler
New submission from Eldon Ziegler [EMAIL PROTECTED]: I updated httplib.py, python 2.4, to be able to bind to a specific IP address when connecting to a remote site. conn = httplib.HTTPConnection('82.94.237.218', 80) will connect to '82.94.237.218' using one of the local IP addresses

Finding IP address of localhost via socket API (or other API)

2008-08-05 Thread David York
Does anybody know how to find the real IP address (e.g.: address visible to internet) of a machine via Python? In other words I have a machine with an IP address something like 192.168.1.5, an address given to me by a router. The router's address (and thus my machine's address) to the outside

Re: Finding IP address of localhost via socket API (or other API)

2008-08-05 Thread Timothy Grant
On Tue, Aug 5, 2008 at 2:50 PM, David York [EMAIL PROTECTED] wrote: Does anybody know how to find the real IP address (e.g.: address visible to internet) of a machine via Python? In other words I have a machine with an IP address something like 192.168.1.5, an address given to me by a router

Re: Finding IP address of localhost via socket API (or other API)

2008-08-05 Thread Diez B. Roggisch
Timothy Grant schrieb: On Tue, Aug 5, 2008 at 2:50 PM, David York [EMAIL PROTECTED] wrote: Does anybody know how to find the real IP address (e.g.: address visible to internet) of a machine via Python? In other words I have a machine with an IP address something like 192.168.1.5, an address

Re: Finding IP address of localhost via socket API (or other API)

2008-08-05 Thread Christian Heimes
David York wrote: How do I find out my machine's IP address as visible to the outside world? Thanks a lot. Most modern routers home routers support the IGD part of UPnP (http://en.wikipedia.org/wiki/Internet_Gateway_Device_Protocol). You can use an UPnP client software to query the router

Re: Finding IP address of localhost via socket API (or other API)

2008-08-05 Thread Steven D'Aprano
IP address (e.g.: address visible to internet) of a machine via Python? In other words I have a machine with an IP address something like 192.168.1.5, an address given to me by a router. The router's address (and thus my machine's address) to the outside world is something realistic

Re: Finding IP address of localhost via socket API (or other API)

2008-08-05 Thread Emile van Sebille
Steven D'Aprano wrote: The only way I know of is to query an external server that will tell you. There's a few of them out there. Here's a few: http://checkip.dyndns.org/ http://www.showmyip.com http://www.showmyip.com/simple/ http://whatismyip.org/ all four of these show my internal IP

Re: Finding IP address of localhost via socket API (or other API)

2008-08-05 Thread John Machin
On Aug 6, 9:51 am, Emile van Sebille [EMAIL PROTECTED] wrote: Steven D'Aprano wrote: The only way I know of is to query an external server that will tell you. There's a few of them out there. Here's a few: http://checkip.dyndns.org/ http://www.showmyip.com http://www.showmyip.com/simple/

Re: Finding IP address of localhost via socket API (or other API)

2008-08-05 Thread David York
I'm going to look into the Internet Gateway Device protocol and see what it has to offer. If it is more work than it is work I'm going with Steven's suggestion (nice code BTW). And yes, you guys understood what I was asking - I wanted the internet IP address of my machine, not the local subnet

Re: Finding IP address of localhost via socket API (or other API)

2008-08-05 Thread Timothy Grant
, David York [EMAIL PROTECTED] wrote: Does anybody know how to find the real IP address (e.g.: address visible to internet) of a machine via Python? In other words I have a machine with an IP address something like 192.168.1.5, an address given to me by a router. The router's address (and thus my

How to collect all the IP address of the system connected in network?

2008-01-29 Thread Manikandan R
Hai, I am working with python 2.4. I am new to python, I need to collect all the ipaddress of the systems connected in the network for my project. While browsing I come accross Ur link. I think U peoples can help me. Can U please send me the code and guide me to get it. I am

Is netstat in python is enough for getting ip address of all system connected in network

2008-01-28 Thread Manikandan R
hai everybody, I am working in python 2.4. I am in need to get the ip address of all the devices connected in the network. Is its possible in python, can anyone help me please. If its possible, can U give me the code. Mani. -- http://mail.python.org/mailman/listinfo/python

Re: Clean way to get one's network IP address?

2007-11-23 Thread Steven D'Aprano
socket.gethostbyname, but this relies on what's in /etc/hosts, and I'd rather have a more independent solution. I might be missing something in your question, but on a Windows XP machine, I can get the IP address of my machine using: from socket import gethostname, gethostbyname gethostbyname(gethostname

Re: Clean way to get one's network IP address?

2007-11-23 Thread Steven D'Aprano
On Sat, 24 Nov 2007 00:05:13 +, Steven D'Aprano wrote: ... you're absolutely write ... Okay, I now officially have no more credibility left. Time for me to get a Hotmail email address and open a MySpace page and spend all my time writing OMG LOL LOL LOL did u c teh thing on Ausrtalia Idle

Re: Clean way to get one's network IP address?

2007-11-23 Thread MonkeeSage
On Nov 21, 9:15 am, Gilles Ganault [EMAIL PROTECTED] wrote: Hello I need to get the local computer's IP address, ie. what's displayed when running ifconfig in Linux: # ifconfig eth0 Link encap:Ethernet HWaddr 00:15:58:A1:D5:6F inet addr:192.168.0.79 Bcast:192.168.0.255

Re: Clean way to get one's network IP address?

2007-11-23 Thread Steven D'Aprano
On Fri, 23 Nov 2007 15:58:06 -0800, Dennis Lee Bieber wrote: On Fri, 23 Nov 2007 22:56:41 -, Steven D'Aprano [EMAIL PROTECTED] declaimed the following in comp.lang.python: I'm not surprised. Windows XP usually stores the hosts file here: C:\system32\drivers\etc\hosts

Re: Clean way to get one's network IP address?

2007-11-23 Thread Hendrik van Rooyen
Steven D'Aprano ste..HIS-cybersource.com.au wrote: On Sat, 24 Nov 2007 00:05:13 +, Steven D'Aprano wrote: ... you're absolutely write ... Okay, I now officially have no more credibility left. Time for me to get a Hotmail email address and open a MySpace page and spend all my time

Re: Clean way to get one's network IP address?

2007-11-23 Thread [EMAIL PROTECTED]
have a more independent solution. I might be missing something in your question, but on a Windows XP machine, I can get the IP address of my machine using: from socket import gethostname, gethostbyname gethostbyname(gethostname()) '192.168.0.11' Just out of curiosity, what part

Re: Clean way to get one's network IP address?

2007-11-22 Thread John J. Lee
Gilles Ganault [EMAIL PROTECTED] writes: I need to get the local computer's IP address, ie. what's displayed when running ifconfig in Linux: # ifconfig eth0 Link encap:Ethernet HWaddr 00:15:58:A1:D5:6F inet addr:192.168.0.79 Bcast:192.168.0.255 Mask:255.255.255.0 I

Clean way to get one's network IP address?

2007-11-21 Thread Gilles Ganault
Hello I need to get the local computer's IP address, ie. what's displayed when running ifconfig in Linux: # ifconfig eth0 Link encap:Ethernet HWaddr 00:15:58:A1:D5:6F inet addr:192.168.0.79 Bcast:192.168.0.255 Mask:255.255.255.0 I know about socket.gethostbyname

Re: Clean way to get one's network IP address?

2007-11-21 Thread Paul McGuire
On Nov 21, 9:15 am, Gilles Ganault [EMAIL PROTECTED] wrote: Hello I need to get the local computer's IP address, ie. what's displayed when running ifconfig in Linux: # ifconfig eth0 Link encap:Ethernet HWaddr 00:15:58:A1:D5:6F inet addr:192.168.0.79 Bcast:192.168.0.255

Re: Clean way to get one's network IP address?

2007-11-21 Thread Gilles Ganault
On Wed, 21 Nov 2007 07:20:45 -0800 (PST), Paul McGuire [EMAIL PROTECTED] wrote: Be aware that it is very possible to have multiple IP addresses from which to choose Yup, but this is the local host, and it only has a single interface. Should I look into os.environ() or something like that? --

Re: Clean way to get one's network IP address?

2007-11-21 Thread Joe Riopel
On Nov 21, 2007 10:15 AM, Gilles Ganault [EMAIL PROTECTED] wrote: I know about socket.gethostbyname, but this relies on what's in /etc/hosts, and I'd rather have a more independent solution. I might be missing something in your question, but on a Windows XP machine, I can get the IP address

Re: Clean way to get one's network IP address?

2007-11-21 Thread Jean-Paul Calderone
On Wed, 21 Nov 2007 16:15:43 +0100, Gilles Ganault [EMAIL PROTECTED] wrote: Hello I need to get the local computer's IP address, ie. what's displayed when running ifconfig in Linux: # ifconfig eth0 Link encap:Ethernet HWaddr 00:15:58:A1:D5:6F inet addr:192.168.0.79 Bcast

Re: Clean way to get one's network IP address?

2007-11-21 Thread Roy Smith
around and around on this, and ended up with that being the best solution. For us, anyway. Your mileage may vary. As others have pointed out, it's entirely possible to have multiple IP addresses. In addition, your IP address(es) can change as connections come up and down, especially

Re: Clean way to get one's network IP address?

2007-11-21 Thread poltrone
What would be a good way to do this? using 'netifaces'? see http://pypi.python.org/pypi/netifaces/0.3 -- http://mail.python.org/mailman/listinfo/python-list

Re: Clean way to get one's network IP address?

2007-11-21 Thread Steven D'Aprano
, but on a Windows XP machine, I can get the IP address of my machine using: from socket import gethostname, gethostbyname gethostbyname(gethostname()) '192.168.0.11' Just out of curiosity, what part of the Original Poster's comment that he already knew about socket.gethostbyname did you

Re: [OT] The Jew Spam on this list: Blocking the IP address of spammers

2007-11-13 Thread Peter J. Bismuti
Why aren't these spammers having their IP addresses blocked (or something like that)? People making these posts should not be allowed to post ever again. Is there not someone administering this mailing list? I agree! On Nov 13, 2007 1:26 PM, Martin Marcher [EMAIL PROTECTED] wrote:

Re: [OT] The Jew Spam on this list: Blocking the IP address of spammers

2007-11-13 Thread Ben Finney
Peter J. Bismuti [EMAIL PROTECTED] writes: Why aren't these spammers having their IP addresses blocked (or something like that)? People making these posts should not be allowed to post ever again. Is there not someone administering this mailing list? This mailing list is actually a mail

Arp request to get MAc Adress with IP address

2007-10-30 Thread amjadcsu
Hello, I have a network on same subnet. I have an ip address of a machine. but i need to get its MAC Adress. Sendingf ARP request is the way i am taking. IS there any other way to get this MAC Adress in python.?? Also does python go down to level 2 of TCP/IP model?? Sorry if i am to naive

Re: Arp request to get MAc Adress with IP address

2007-10-30 Thread Jonathan Gardner
On Oct 30, 1:57 pm, [EMAIL PROTECTED] wrote: Hello, I have a network on same subnet. I have an ip address of a machine. but i need to get its MAC Adress. Sendingf ARP request is the way i am taking. IS there any other way to get this MAC Adress in python.?? Also does python go down

Re: Arp request to get MAc Adress with IP address

2007-10-30 Thread Yu-Xi Lim
[EMAIL PROTECTED] wrote: Hello, I have a network on same subnet. I have an ip address of a machine. but i need to get its MAC Adress. Sendingf ARP request is the way i am taking. IS there any other way to get this MAC Adress in python.?? Also does python go down to level 2 of TCP/IP

How to change IP Address by Python program on Win Platform

2007-10-24 Thread Don Bro
is there software available to change or hide my ip add? __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get IP address of client from CGI module?

2007-04-11 Thread Cameron Laird
In article [EMAIL PROTECTED], John Nagle [EMAIL PROTECTED] wrote: The documentation for Python's CGI module doesn't seem to say how to get the IP address of the client. Don't see an obvious way to get that info from reading the source, either. Ideas

How to get IP address of client from CGI module?

2007-04-10 Thread John Nagle
The documentation for Python's CGI module doesn't seem to say how to get the IP address of the client. Don't see an obvious way to get that info from reading the source, either. Ideas? John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get IP address of client from CGI module?

2007-04-10 Thread Graham Dumpleton
On Apr 11, 12:22 pm, John Nagle [EMAIL PROTECTED] wrote: The documentation for Python's CGI module doesn't seem to say how to get the IP address of the client. Don't see an obvious way to get that info from reading the source, either. Ideas? John

Re: Getting external IP address

2007-03-06 Thread Steven D'Aprano
On Mon, 05 Mar 2007 09:02:44 +, Duncan Booth wrote: Try running it interactively and looking at the data you receive: conn = HTTPConnection('xml.showmyip.com') conn.request('GET', '/') resp = conn.getresponse() print resp httplib.HTTPResponse instance at 0x00C58350 data =

Re: Getting external IP address

2007-03-06 Thread Sion Arrowsmith
Steven D'Aprano [EMAIL PROTECTED] wrote: I have a PC behind a firewall, and I'm trying to programmatically determine the IP address visible from outside the firewall. [ ... ] Can anyone help me fix that code snippet, or suggest another (better) way to get the externally visible IP address

Re: Getting external IP address

2007-03-06 Thread Cousin Stanley
I have a PC behind a firewall, and I'm trying to programmatically determine the IP address visible from outside the firewall. Steven Following is another alternative that might at least be worth consideration I use the lynx command shown as a command-line alias

Re: Getting external IP address

2007-03-06 Thread Sergio Correia
no parsing is necessary Best, Sergio On 3/6/07, Cousin Stanley [EMAIL PROTECTED] wrote: I have a PC behind a firewall, and I'm trying to programmatically determine the IP address visible from outside the firewall. Steven Following is another alternative that might at least

Re: Getting external IP address

2007-03-06 Thread Steven D'Aprano
On Tue, 06 Mar 2007 14:40:37 -0500, Sergio Correia wrote: The above suggestions seem nice, but I find this one easier: [snip] Thanks to everybody who replied, that's great. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list

Getting external IP address

2007-03-05 Thread Steven D'Aprano
I have a PC behind a firewall, and I'm trying to programmatically determine the IP address visible from outside the firewall. If I do this: import socket socket.gethostbyname(socket.gethostname()) '127.0.0.1' socket.gethostbyname_ex(socket.gethostname()) ('localhost.localdomain', ['localhost

Re: Getting external IP address

2007-03-05 Thread Duncan Booth
fix that code snippet, or suggest another (better) way to get the externally visible IP address? Try running it interactively and looking at the data you receive: conn = HTTPConnection('xml.showmyip.com') conn.request('GET', '/') resp = conn.getresponse() print resp httplib.HTTPResponse

Re: Getting external IP address

2007-03-05 Thread Paul Rubin
Duncan Booth [EMAIL PROTECTED] writes: If you try connecting to 'www.showmyip.com' and requesting '/xml/' it should work. If the firewall is really obnoxious, it can bounce consecutive queries around between multiple originating IP addresses. That is uncommon but it's been done from time to

Re: Getting external IP address

2007-03-05 Thread Duncan Booth
Paul Rubin http://[EMAIL PROTECTED] wrote: Duncan Booth [EMAIL PROTECTED] writes: If you try connecting to 'www.showmyip.com' and requesting '/xml/' it should work. If the firewall is really obnoxious, it can bounce consecutive queries around between multiple originating IP addresses.

Re: IP address

2007-01-29 Thread Scripter47
Beej skrev: On Jan 28, 2:26 am, Klaus Alexander Seistrup [EMAIL PROTECTED] wrote: Scripter47 wrote: How do i get my ip address? in cmd.exe i just type ipconfig then it prints: ... IP-address . . . . . . . . . . . . . . . . . : 192.168.1.10 ... how can i do that in python

Re: Ip address

2007-01-29 Thread Steve Holden
Toby A Inkster wrote: Steve Holden wrote: There is absolutely no need to know the IP address of your router to communicate with Internet devices. Either your IP layer is configured to know the addresses of one or more routers, or it has discovered those address by dynamic means, or you

Ip address

2007-01-28 Thread Scripter47
How do i get my ip address? in cmd.exe i just type ipconfig then it prints: ... IP-address . . . . . . . . . . . . . . . . . : 192.168.1.10 ... how can i do that in python?? -- http://mail.python.org/mailman/listinfo/python-list

Re: IP address

2007-01-28 Thread Klaus Alexander Seistrup
Scripter47 wrote: How do i get my ip address? in cmd.exe i just type ipconfig then it prints: ... IP-address . . . . . . . . . . . . . . . . . : 192.168.1.10 ... how can i do that in python?? #v+ python -c 'import re, urllib; print re.findall(titleYour IP: (.+?)/title

Re: Mulig SPAM: Re: IP address

2007-01-28 Thread Scripter47
Klaus Alexander Seistrup skrev: Scripter47 wrote: How do i get my ip address? in cmd.exe i just type ipconfig then it prints: ... IP-address . . . . . . . . . . . . . . . . . : 192.168.1.10 ... how can i do that in python?? #v+ python -c 'import re, urllib; print

Re: IP address

2007-01-28 Thread Klaus Alexander Seistrup
Scripter47 wrote: python -c 'import re, urllib; print re.findall(titleYour IP: (.+?)/title, urllib.urlopen(http://myip.dk/;).read())[0]' Hmm then you need Internet connecting. That's what IP adresses are for... can i do it without that? Perhaps you could use the method mentioned in

Re: Ip address

2007-01-28 Thread Adam
Hey, This will get your IP address: ###Code print socket.gethostbyaddr(socket.gethostname()) ('compname', [], ['192.168.1.2']) End Code If you are wanting to to communicate over the internet you will have to get the IP of you rounter. So you will have to either find

Re: IP address

2007-01-28 Thread Colin J. Williams
Klaus Alexander Seistrup wrote: Scripter47 wrote: How do i get my ip address? in cmd.exe i just type ipconfig then it prints: ... IP-address . . . . . . . . . . . . . . . . . : 192.168.1.10 ... how can i do that in python?? #v+ python -c 'import re, urllib; print

Re: IP address

2007-01-28 Thread Klaus Alexander Seistrup
Adam wrote: This will get your IP address: ###Code print socket.gethostbyaddr(socket.gethostname()) ('compname', [], ['192.168.1.2']) End Code It will return an IP address, but not necessarily the one you want: #v+ [EMAIL PROTECTED]:~ $ python -c 'import

Re: IP address

2007-01-28 Thread Klaus Alexander Seistrup
Colin J. Williams wrote: Your one-liner doesn't work for me, with Windows XP, but the following does, within Python. Could it be due to shell-escaping issues? I don't know anything about Windows... Cheers, -- Klaus Alexander Seistrup http://klaus.seistrup.dk/ --

Re: Ip address

2007-01-28 Thread Steve Holden
Adam wrote: Hey, This will get your IP address: ###Code print socket.gethostbyaddr(socket.gethostname()) ('compname', [], ['192.168.1.2']) End Code If you are wanting to to communicate over the internet you will have to get the IP of you rounter. So you

Re: Ip address

2007-01-28 Thread Toby A Inkster
Steve Holden wrote: There is absolutely no need to know the IP address of your router to communicate with Internet devices. Either your IP layer is configured to know the addresses of one or more routers, or it has discovered those address by dynamic means, or you can't get off-net because

Re: Ip address

2007-01-28 Thread Toby A Inkster
Scripter47 wrote: How do i get my ip address? Which IP address. One computer might have many IP addresses. (Indeed a typical network-connected computer will tend to have at least one for each connected network device, plus the special address 127.0.0.1 for the loopback network.) How is Python

Re: IP address

2007-01-28 Thread Gabriel Genellina
At Sunday 28/1/2007 10:28, Colin J. Williams wrote: Klaus Alexander Seistrup wrote: python -c 'import re, urllib; print re.findall(titleYour IP: (.+?)/title, urllib.urlopen(http://myip.dk/;).read())[0]' Your one-liner doesn't work for me, with Windows XP, but the following On XP you

Re: IP address

2007-01-28 Thread Garry Knight
Klaus Alexander Seistrup wrote: urllib.urlopen(http://myip.dk/;) http://whatismyip.org gives it to you in a more usable format. But, as others have pointed out, it might return your router's IP. -- Garry Knight [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: IP address

2007-01-28 Thread Beej
On Jan 28, 2:26 am, Klaus Alexander Seistrup [EMAIL PROTECTED] wrote: Scripter47 wrote: How do i get my ip address? in cmd.exe i just type ipconfig then it prints: ... IP-address . . . . . . . . . . . . . . . . . : 192.168.1.10 ... how can i do that in python??#v

Re: Ip address

2007-01-28 Thread Adonis Vargas
Scripter47 wrote: How do i get my ip address? in cmd.exe i just type ipconfig then it prints: ... IP-address . . . . . . . . . . . . . . . . . : 192.168.1.10 ... how can i do that in python?? If you want to get your external IP you can do: import urllib checkIP

IP address of webserver

2007-01-27 Thread Johny
How can I find server's IP address? From console I can use ping, for example: C:\RobotP\cgi-binping www.google.com Pinging www.google.com [209.85.129.147] with 32 bytes of data: Reply from 209.85.129.147: bytes=32 time=30ms TTL=244 Reply from 209.85.129.147: bytes=32 time=30ms TTL=244 .. .. So

<    1   2   3   4   >