Raise error when api key is empty

So empty API key now gives the same behaviour as when it's not provided at all.