$ git clone https://github.com/caioportela/sheetgo-test.git
$ cd sheetgo-test
$ pip install -r requirements.txt
To run the application use
$ export FLASK_APP=src/app.py
$ flask run
or simply
$ python src/app.py
The application is now running on http://localhost:5000
.
Authorization is needed in all endpoints and there's a script to generate a valid token.
$ python src/auth_token.py
Requesting the API through cURL with a valid token:
-
/excel/info
- Returns the list of the tabs from the excel file, ordered alphabeticallyfile
: binary xlsx file
$ curl -X POST http://localhost:5000/excel/info -H "Authorization:$(python src/auth_token.py)" -F file=@sample1.xlsx
-
/image/convert
- Converts the format of an imagefile
: image file to convertformat
: format of the output image;jpeg
orpng
$ curl -X POST http://localhost:5000/image/convert -H "Authorization:$(python src/auth_token.py)" -F file=@image1.jpeg -F format=png
-
/image/convert/fromdropbox
- Converts the format of an image from Dropbox tojpeg
orpng
Dropbox-Token
: generated access token from dropbox apppath
: path of the image stored on dropboxformat
: format of the output image;jpeg
orpng
$ curl -X POST http://localhost:5000/image/convert/fromdropbox -H "Authorization:$(python src/auth_token.py)" -H "Dropbox-Token:<access_token>" -d path=/image.jpeg -d format=png
pytest
was used for the unit testing
$ pytest