nk9 / get_dropbox_link

Code to get the URL of a file in the Dropbox folder
MIT License
7 stars 1 forks source link

--query argument fails with: Unsupported operand type(s) for 'dict' #12

Closed porg closed 1 year ago

porg commented 1 year ago

After the recent changes in 310b32c for:

✅ Filepath as the only argument works normal

$ get_dropbox_link.py ~/Dropbox/Public/test-2023-08-15a.txt 
https://www.dropbox.com/s/zk0z1wbblfh0e23/test-2023-08-15a.txt?dl=0

Note: Luckily I'm getting the classic /s/ style links again.

❌ Custom arguments result in error

$ get_dropbox_link.py ~/Dropbox/Public/test-2023-08-15a.txt --query 'raw=1'
ERROR:root:unsupported operand type(s) for |: 'dict' and 'dict'

All possible permutations I tried failed with the same error:

Environment

nk9 commented 1 year ago

This is an issue with a newer Python feature, the union operator. In my testing, lower versions of Python 3.8 don't support this, whereas later versions of 3.8 and all versions of 3.9+ do.

I've changed to using the more broadly-supported {**a, **b} dict merging syntax.

porg commented 1 year ago

Tested and now worked with Python 3.11.4 on macOS 11.8.8 Big Sur.