401 for post requests

TC2:create new user | FAIL |

HTTPError: 401 Client Error: Unauthorized for url: https://gorest.co.in/public/v2/users

TC | FAIL |

getting this error when trying from pycharm through a python code

``` import requests

url = "https://gorest.co.in/public/v2/users" headers = { "Accept": "application/json", "Content-Type": "application/json", "Authorization": "Bearer YOURACCESSTOKEN" }

data = { "name": "Tenali Ramakrishna", "gender": "male", "email": "tenali.ramakrishna@15ce01.com", "status": "active" }

response = requests.post(url, headers=headers, json=data)

print(response.status_code) print(response.json())

```

import requests

url = "https://gorest.co.in/public/v2/users"

headers = { "Accept": "application/json", "Content-Type": "application/json", "Authorization": "Bearer YOURACCESSTOKEN" }

data = { "name": "Tenali Ramakrishna", "gender": "male", "email": "tenali.ramakrishna@15ce01.com", "status": "active" }

response = requests.post(url, headers=headers, json=data)

print(response.status_code)

print(response.json())


Little markdown supported