Skip to content

Commit 5140cb5

Browse files
author
foudfou
committed
Revert "Add user-agent header for providers."
This reverts commit 2032e47. Conflicts: gandi_dyndns.py
1 parent e6afdb0 commit 5140cb5

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

gandi_dyndns.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
# multiple-provider agreement before returning an IP.
1616
IP_ADDRESS_REGEX = re.compile('\d{1,3}(?:\.\d{1,3}){3}')
1717

18-
USER_AGENT = 'Mozilla/5.0'
19-
20-
2118
class GandiServerProxy(object):
2219
'''
2320
Proxy calls to an internal xmlrpclib.ServerProxy instance, accounting for the
@@ -66,9 +63,8 @@ def get_external_ip_from_url(url):
6663
'''Get all the IP addresses found at a given URL.'''
6764

6865
# open the website, download its data, and return all IP strings found
69-
opener = urllib2.build_opener()
70-
opener.addheaders = [('User-agent', USER_AGENT)]
71-
data = opener.open(url, timeout=10).read()
66+
# we want to respect some site's filtering on User-Agent.
67+
data = urllib2.urlopen(url, timeout=10).read()
7268
addys = IP_ADDRESS_REGEX.findall(data)
7369
return addys
7470

0 commit comments

Comments
 (0)