質問

I'm using the Requests library to send data to a server, using the following code:

r=requests.post(
        url='http://localhost:8000/api/open/',
        data=json.dumps({"name":"awdawd"}),
        headers={'content-type':'aplication/json'},
    )

However, I'm getting the following error:

"error_message": "The format indicated 'aplication/json' had no available deserialization method. Please check your ``formats`` and ``content_types`` on your Serializer."

Does anyone have a clue on this?

Thanks very much

役に立ちましたか?

解決

Its just a misspelling in application

r=requests.post(url='http://localhost:8000/api/open/',                
                data=json.dumps({"name":"awdawd"}),
                headers={'content-type':'application/json'})
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top