Mercurial > repos > bernhardlutz > rest_tool
view readfile.py @ 4:54358dfa62c0 draft
Uploaded
author | bernhardlutz |
---|---|
date | Fri, 28 Mar 2014 13:41:22 -0400 |
parents | |
children | 3c1e862e8cd6 |
line wrap: on
line source
#!/usr/bin/env python import io import urllib2, urllib, httplib def getListFromFile(file): idlist=[] for line in file: if int(line): idlist.append(line.strip()) return idlist def getresult(url): try: connection = urllib2.urlopen(url) except urllib2.HTTPError, e: return "" else: return connection.read().rstrip()