Implementing API upload

To start implementing our upload function, we need to figure out what kind of requests we're going to send. We've been provided with some documentation from the corporate office that describes how to interact with the REST API.

The documentation tells us the following things:

  • We first need to obtain an authentication token. We do this by submitting a POST request to the /auth endpoint. The parameters of the POST request should include username and password.
  • With the authentication token acquired, we'll need to submit our CSV file. The request is a PUT request sent to the /upload endpoint. The file is uploaded as multipart form data specified in a file parameter.

We already know enough to implement our REST upload ...

Get Python GUI Programming with Tkinter now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.