Mercurial > repos > bernhardlutz > rest_tool
view readfile.py @ 6:9ee84d9fd3a7 draft
Uploaded
author | bernhardlutz |
---|---|
date | Thu, 03 Apr 2014 06:50:57 -0400 |
parents | 54358dfa62c0 |
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()