requestsを使ってみた

python manage.py shell でapiを叩いてみた

import json
import requests
url='http://hogehoge/login'
headers = {'content-type':'application/json'}
payload = {"domainId":"hoge","userName":"hoge","password":"hoge"}
r = requests.post(url,data=json.dumps(payload),headers=headers)
r.json()