Change default IP address lookup URI
icanhazip.com has two other domains for fine-tuned IP lookup, ipv4.icanhazip.com will always return the IPv4 address, and ipv6.icanhazip.com will always return the IPv6 address (the latter appears to only work if you actually have an IPv6 address). Details at http://rackerhacker.com/icanhazip-com-faq/. Closes #68.
This commit is contained in:
parent
c5b37b3913
commit
0acfd8437a
|
@ -24,7 +24,7 @@ def date(format='%Y-%m-%d'):
|
||||||
|
|
||||||
|
|
||||||
@memoize(600, persistent=True)
|
@memoize(600, persistent=True)
|
||||||
def external_ip(query_url='http://icanhazip.com/'):
|
def external_ip(query_url='http://ipv4.icanhazip.com/'):
|
||||||
import urllib2
|
import urllib2
|
||||||
try:
|
try:
|
||||||
return urllib2.urlopen(query_url).read().strip()
|
return urllib2.urlopen(query_url).read().strip()
|
||||||
|
|
Loading…
Reference in New Issue