This is what I am running:
import requests
from requests.auth import HTTPBasicAuth
import json
url = "https://foo.atlassian.net/wiki/api/v2/attachments"
auth = HTTPBasicAuth("foo.bar@foobar.com", "MY_API_TOKEN")
headers = {
"Accept": "application/json",
}
response = requests.request(
"GET",
url,
headers=headers,
auth=auth
)
print(response)
Hi @Linda Zhao
Welcome to the community.
Please take a look at this doc: Basic auth for REST APIs
Provide the encoded string in header.
Thanks for the prompt reponse!
It is my understanding that in python requests
auth = HTTPBasicAuth("foo.bar@foobar.com", "MY_API_TOKEN")
accomplishes the same thing as adding that to the header,
nonetheless i also tried adding
headers = {
"Accept": "application/json",
"Authorization": "Basic ENCODED_STRING",
}
to no avail.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am also following the code guide posted on the API reference:
https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-attachment/#api-attachments-get
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.