request with User-Agent 'Isso/...', #151
This commit is contained in:
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…
Reference in New Issue
Block a user