Quantcast
Channel: Data Science, Analytics and Big Data discussions - Latest topics
Viewing all articles
Browse latest Browse all 4448

Need to call POST method of REST API

$
0
0

@sachin123456 wrote:

I am trying like this - I have a rest API and using post method to call this API.
First I am trying to have authentication and later the body and the URL.

import requests
import json
from requests.auth import HTTPBasicAuth
requests.get(‘url’, auth=HTTPBasicAuth(‘username’, ‘pass’))

payload = {‘name’:‘rest_python’,‘domainId’:‘7319ca59-f9d4-4f86-9eaf-a359691b378b’,‘typeId’:‘00000000-0000-0000-0000-000000011001’}
response = requests.post(url, data=payload)

print(response.text) #TEXT/HTML
print(response.status_code)

it says
401

what would be the issue here.

Thanks,
Sachin

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4448

Trending Articles