Mercurial > repos > bernhardlutz > rest_tool
annotate readfile.py @ 4:54358dfa62c0 draft
Uploaded
author | bernhardlutz |
---|---|
date | Fri, 28 Mar 2014 13:41:22 -0400 |
parents | |
children | 3c1e862e8cd6 |
rev | line source |
---|---|
4 | 1 #!/usr/bin/env python |
2 | |
3 import io | |
4 import urllib2, urllib, httplib | |
5 def getListFromFile(file): | |
6 idlist=[] | |
7 for line in file: | |
8 if int(line): | |
9 idlist.append(line.strip()) | |
10 return idlist | |
11 | |
12 def getresult(url): | |
13 try: | |
14 connection = urllib2.urlopen(url) | |
15 except urllib2.HTTPError, e: | |
16 return "" | |
17 else: | |
18 return connection.read().rstrip() | |
19 |