Exemplo n.º 1
0
def add_user():
    args = request.form
    #TODO: Add parameter verification
    userName = str(args.get('userName'))
    blob = str(args.get('blob'))
    clientKey = str(args.get('clientKey'))

    #Username, blob, and clientKey would be passed to SpConnectionLoginZeroConf, and then SpConnectionLoginZeroConf decrypts the blob, and calls SpConnectionLoginBlob
    lib.SpConnectionLoginZeroConf(userName, blob, clientKey)
    #SpConnectionLoginBlob(userName, decrypted_blob)

    return jsonify({
        'status': 101,
        'spotifyError': 0,
        'statusString': 'ERROR-OK'
        })
Exemplo n.º 2
0
    def login(self, username=None, password=None, blob=None, zeroconf=None):
        if username is not None:
            self.credentials['username'] = username
        elif self.credentials['username']:
            username = self.credentials['username']
        else:
            raise ValueError("No username given, and none stored")

        if password is not None:
            lib.SpConnectionLoginPassword(username, password)
        elif blob is not None:
            lib.SpConnectionLoginBlob(username, blob)
        elif zeroconf is not None:
            lib.SpConnectionLoginZeroConf(username, *zeroconf)
        else:
            raise ValueError("Must specify a login method (password, blob or zeroconf)")