Http/POST
import urllib import urllib2 query = {"mail":"a@mknod.jp", "password":"123"} query = urllib.urlencode(query) resp = urllib2.urlopen("http://localhost:3000/api/login/", query) resp.msg, resp.code resp.geturl() resp.info() resp.read() resp.realdline()
Http/GET
req = urllib2.Request("http://localhost:3000/api/project") req.add_header("Content-Type", "application/x-www-form-urlencoded") req.add_header("Authorization", "Token f93768d4-13fd-4246-bd31-863e140bb1f3") resp = urllib2.urlopen(req) resp.msg, resp.code