Skip to content

Instantly share code, notes, and snippets.

@salmanwahed
Last active August 29, 2015 14:20
Show Gist options
  • Save salmanwahed/131ae771d4c553964709 to your computer and use it in GitHub Desktop.
Save salmanwahed/131ae771d4c553964709 to your computer and use it in GitHub Desktop.
testing rest api
In [1]: from requests import get, post, put, delete
In [2]: get("http://127.0.0.1:5000/api")
In [3]: data = {"name": "Example Name", "registration": "123433199", "department": "cse"}
In [4]: post("http://127.0.0.1:5000/api", json=data).json()
In [5]: put("http://127.0.0.1:5000/api/123433199", json={"website": "www.example.com"}).json()
In [6]: delete("http://127.0.0.1:5000/api/123433199").json()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment