# CCS CS Lab Delicious Utilities # # Douglas Thrift # # $Id$ import base64 import contextlib import httplib def authenticate(username, password): with contextlib.closing(httplib.HTTPSConnection('api.del.icio.us', strict = True)) as connection: connection.request('HEAD', '/v1/posts/update', headers = {'Authorization': 'Basic ' + base64.b64encode('%s:%s' % (username, password))}) return connection.getresponse().status == 200