Created
November 3, 2019 06:30
-
-
Save afaqk9394/d732eae05c671af5c8c28e38a67eee83 to your computer and use it in GitHub Desktop.
REST API PUT Operation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| import json | |
| token = 'z8-sXMth942nOiQqXuikCNjbamrAlI2IjS7g' | |
| url = 'https://gorest.co.in/public-api/users/1571' | |
| data = {"email":"ja@honest.com","first_name":"Jessica","last_name":"Alba","gender":"female"} | |
| result = requests.put(url, | |
| headers={'Content-Type':'application/json', | |
| 'Authorization': 'Bearer {}'.format(token)},data=json.dumps(data)) | |
| print('Code: ', result.status_code) | |
| print('Content: ', result.content.decode()[:500] + '...') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment