문제

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