request with User-Agent 'Isso/...', #151

legacy/0.9
Martin Zimmermann 9 years ago
parent 56c81c2d06
commit 596acb7f79

@ -7,6 +7,7 @@ try:
except ImportError:
import http.client as httplib
from isso import dist
from isso.wsgi import urlsplit
@ -21,6 +22,10 @@ class curl(object):
return resp.status
"""
headers = {
"User-Agent": "Isso/{0} (+http://posativ.org/isso)".format(dist.version)
}
def __init__(self, method, host, path, timeout=3):
self.method = method
self.host = host
@ -35,7 +40,7 @@ class curl(object):
self.con = http(host, port, timeout=self.timeout)
try:
self.con.request(self.method, self.path)
self.con.request(self.method, self.path, headers=self.headers)
except (httplib.HTTPException, socket.error):
return None

Loading…
Cancel
Save