def basic_auth_string(username, password):
    b64 = base64.encodestring('%s:%s' % (username, password)).strip()
    return 'Basic %s' % b64
Encode a username and password for use in an HTTP Basic Authentication
dataset/ETHPy150Open eallik/spinoff/spinoff/util/http.py/basic_auth_string