Popular posts from this blog
Driving API interactions with Scripting
* REST API calls from Python 1. Install 'requests' module python -m pip install requests 2. Go to python mode. Apply GET, POST, PUT and DELETE methods. $ python // Import the module that was imported earlier >>> import requests //Set the url >>> url = 'http://jsonplaceholder.typicode.com/photos' // GET command >>> response = requests.get(url) >>> print ( response.json() ) // The above command will return the json data for all the images >>> jsonPayload = { 'albumId': 1, 'title': 'test', 'url': 'nothing.com', 'thumbnailUrl': 'nothing.com'} >>> response = requests.post( url, json=jsonPayload' ) >>> response.json() {'albumId': 1, 'title': 'test', 'url': 'nothing.com', 'thumbnailUrl': 'nothing.com', 'id': 5001} >>> url = 'http://jsonplaceholder....
Comments
Post a Comment