Skip to content

Commit 431383e

Browse files
committed
update source URL and convert to python3
1 parent 451869f commit 431383e

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

print_osg_repos

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22

3-
import urllib2
4-
import libxml2
3+
import urllib.request
4+
import lxml.etree
55
import sys
66

77
printurls = False
@@ -10,13 +10,12 @@ if (len(sys.argv) == 2) and (sys.argv[1] == '-u'):
1010
elif len(sys.argv) != 1:
1111
sys.exit("Usage: print_osg_repos [-u]")
1212

13-
response = urllib2.urlopen("http://myosg.grid.iu.edu/vosummary/xml?summary_attrs_showoasis=on&all_vos=on&active=on&active_value=1&sort_key=name")
14-
xml = response.read()
15-
doc = libxml2.parseDoc(xml)
13+
response = urllib.request.urlopen("http://my.opensciencegrid.org/vosummary/xml?summary_attrs_showoasis=on&all_vos=on&active=on&active_value=1&sort_key=name")
14+
doc = lxml.etree.XML(response.read())
1615

1716
repos = []
18-
for urlfield in doc.xpathEval("//VO/OASIS/OASISRepoURLs/URL"):
19-
url = urlfield.content
17+
for urlfield in doc.xpath("//VO/OASIS/OASISRepoURLs/URL"):
18+
url = urlfield.text
2019
if url[-1] == '/':
2120
# remove a trailing slash
2221
url = url[:-1]
@@ -27,4 +26,4 @@ for urlfield in doc.xpathEval("//VO/OASIS/OASISRepoURLs/URL"):
2726

2827
repos.sort()
2928
for repo in repos:
30-
print repo
29+
print (repo)

0 commit comments

Comments
 (0)