OUR EXPERT
QUICK TIP
QUICK TIP
RE ADING ENVIRONMENT VARIABLES IN PYTHON
QUICK TIP
USING CURL WITH DROPBOX REST API
OUR EXPERT
Mihalis Tsoukalos is a systems engineer and technical writer. He’s the author of Go Systems Programming and Mastering Go, third edition.
Get the for this tutorial from the Linux Format archive: www. linuxformat. com/archives ?issue=286
If your programming language of choice isn’t in the list of officially supported programming languages, look at www. dropbox.com/ developers/ documentation/ communitysdks where you can find thirdparty libraries for more programming languages. However, these libraries aren’t developed or maintained by Dropbox.
Sensitive information shouldn’t be hardcoded or transferred in plain text format. A simple solution is the use of environment variables for keeping sensitive information on specific machines only. We’re going to explain how to do that in Python – the relevant source code file is envVar.py. The Python code that illustrates all previous information is the following:
The official Dropbox page (https:// dropbox.github. io/dropbox-apiv2-explorer) enables you to explore the Dropbox API. It can display your request as a curl command, Python code that uses the requests library, Python code that uses the standard library and as an HTTP request. This is the ideal location to learn the Dropbox REST API.
Although Python is perfect for writing professional applications that can also be used in Docker images, curl is very handy for testing and experimenting. Dropbox API Explorer (https://dropbox.github.io/dropbox-api-v2-explorer) can compose the curl commands for you provided that you know what you’re looking for. Because Dropbox considers Dropbox API v2 Explorer a new program, you’re going to need to create a new (temporary) access token – this can be done in the Dropbox API v2 Explorer web page (the Get Token link is in the upper-right corner). You can get the metadata of the