trello-full-backup
trello-full-backup copied to clipboard
Exception JSONDecodeError
I get this error when I try to run the script:
Traceback (most recent call last):
File "main.py", line 232, in <module>
org_boards_data['me'] = requests.get(my_boards_url).json()
File "/usr/local/lib/python3.5/site-packages/requests/models.py", line 826, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/local/Cellar/python3/3.5.2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/json/__init__.py", line 319, in loads
return _default_decoder.decode(s)
File "/usr/local/Cellar/python3/3.5.2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/Cellar/python3/3.5.2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
- I have double checked that the environment variables are set.
- I have installed requests via "pip3 install requests"
- I'm running python 3.5.2 on Mac OS X El Capitan installed via homebrew (python3)
Any idea? thanks
Hi,
Quickest way to debug it would be to add a print statement to display the my_board_url variable to check its value. It should be something like this: https://api.trello.com/1/members/me/boards?key=YOUR_KEY&token=YOUR_TOKEN Paste the URL in a web browser to see what you get. Could it be related to the environment variables being reset when restarting the shell?
Let me know if it helps!
I am getting a similar error using the docker method, and it works just fine when I insert the key and token into the URL you suggested above. Any further things I could try to fix this?
Backup initiated Backing up to: 2018-03-13_20-58-40_backup Incremental: False Tokenize: False Backup closed board: False Backup archived lists: False Backup archived cards: False Attachment size limit (bytes): 100000000
Traceback (most recent call last):
File "/usr/local/bin/trello-full-backup", line 11, in
Are the credentials (TRELLO_API_KEY
and TRELLO_TOKEN
) provided when using the docker run
command?
docker run -t -e TRELLO_API_KEY=YOUR_KEY -e TRELLO_TOKEN=YOUR_TOKEN ...
Yes they are. I also used the Trello Sandbox to verify whether the credentials are right and the sandbox manages to fetch all the board content correctly.
I also tried to create a new Trello account and tested it out, same results. I am trying from an iMac and a Macbook as well as a Synology NAS, same results on each.
I also tried accessing the URL you mentioned above in Postman as well as the browser and it works fine every time, returning all the boards. It's just the script that's failing. Anything else I can try?
As mentioned in https://community.atlassian.com/t5/Trello-questions/Re-Re-Trello-API-Invalid-Key/qaq-p/1282962/comment-id/21077#M21077, I was getting the same error when trying to run trello-full-backup
with Docker, because my Trello Token was wrong (32-chars-long instead of 64), because the Token generation URL I had provided in .env.example was missing the response_type=token
parameter.
I've had this happen intermittently, with a large board where sometimes the API fails with status 504 Gateway Timeout.
I've created https://github.com/jtpio/trello-full-backup/pull/37 which makes it a bit clearer what's happening by raising an HTTPError instead of JSONDecodeError. (It was trying to JSON-decode the HTML error body.)
For reference, I got that error again today.
I fixed it by replacing the following parameter: --env-file ./.env
(file in which TRELLO_API_KEY
and TRELLO_TOKEN
are defined) by -e TRELLO_API_KEY="xxx" -e TRELLO_TOKEN="xxx"
, in the docker
command.