I'd prefer to catch the specific exception when we can. It looks like this exception should be a case of a ValueErorr thrown from the json module. It comes from running json.loads("") on an empty string, which is the body in the empty post case.

So a change to try: except ValueError: and then the else block can raise a ValueError('No url provided') or something to hint at why the else clause is a 400.