Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Unauthorized Organization

Isaac January 6, 2021

First off, I am totally new to REST API's and Python 🙃

 

I am trying to piece together an automated export of a Trello board and have looked through the code offerings of some other users: trello-python-demo/demo_bc_org_backup.py at 57f57b4577a3179650b3421cb4f299394828d337 · bmccormack/trello-python-demo · GitHub, Atlassian documentation.

 

I currently have this written and making a POST but I am getting a "unauthorized organization" error. Any thoughts on what I might be doing wrong? (I am not a business class user myself, but I am part of a team)

 

# This code sample uses the 'requests' library:
# http://docs.python-requests.org

import requests
import json

# Set key and token here or get it from settings.py (preferred)
key = ''
# if you're storing your key in this file, you don't need the following three lines
if not key:
from settings import trello_key
key = trello_key

token = ''
# if you're storing your token in this file, you don't need the following three lines
if not token:
from settings import trello_token
token = trello_token

board = ''
# if you're storing your token in this file, you don't need the following three lines
if not board:
from settings import master_id
board = master_id

org = ''
# if you're storing your token in this file, you don't need the following three lines
if not org:
from settings import org_id
org = org_id

# CREATE EXPORTS



# get boards
#url = "https://api.trello.com/1/boards/%s/cards" % (board)
# get org export
url = "https://api.trello.com/1/organizations/%s/exports" % (org)

headers = {
"Accept": "application/json"
}

query = {
'key': key,
'token': token,
}

response = requests.request(
"POST",
url,
headers=headers,
params=query
)

#response = requests.request(
# "GET",
# url,
# headers=headers,
# params=query
#)

# Simple text return for testing
print(response.text)

# print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": ")))

 

1 answer

1 accepted

0 votes
Answer accepted
Vini
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 11, 2021

Hi Isaac, welcome to the Trello community!

For this type of question, I believe you are much more likely to get an answer by posting on our Developers Community instead: https://community.developer.atlassian.com

Many experienced developers as well as Trello Engineers are often hanging out in that forum and I'm sure someone will be able to help with your API questions there!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events