AttributeError: ‘str’ object has no attribute ‘items’

You are passing in a string; headers can’t ever be a JSON encoded string, it is always a Python dictionary. The print results are deceptive; JSON encoded objects look a lot like Python dictionary representations but they are far from the same thing. The requests API clearly states that headers must be a dictionary: headers – (optional) Dictionary of HTTP Headers to send with the Request. JSON data is something you’d … Read more

tech