I want to build a command-line script (in bash or python) that reads files from my company's repo (a private repo in Bitbucket Cloud). My script does the equivalent of this:
curl -O https://bitbucket.org/mycompany/myproject/raw/abc123abc456/test.txt
I would like my script to be usable by coworkers (i.e. holders of valid Bitbucket Cloud accounts at mycompany).
I've created an Oauth consumer as described here, but this requires a callback URL, which is not possible for a command-line script.
I have also tried generating an API token as described here, and passing this as an HTTPDigestAuth password, but that fails (with 401 unauthorized) as well.
How can I generate a token and read from bitbucket cloud without a callback URL?
How should I write a command-line script that generates valid tokens and use them when fetching files from bitbucket cloud?