This is what I am running:
import requestsfrom requests.auth import HTTPBasicAuthimport jsonurl = "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.
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
It looks like you're new here. Sign in or register to get started.