This API is built to perform operations in an Azure Storage Account using python. You do not need to use the azure portal or need the connection string of storage account to access it.
Operations Provided:
- Upload Blobs to Container inside Storage.
- Delete Blobs from Container inside Storage.
- Download Blobs from Container inside Storage.
- List all Blobs present inside the Container in Storage.
- Access Storage Account using code with ease, without repeating unnecessary steps.
- Generate Logs of all operations performed on the Storage with proper Date and Time of operation.
- Config File to change settings separately from main file.
- Enable/Disable operations inside config file.
- API built using FastAPI.
To use the CloudAPI, follow these steps:
-
Clone this project
-
Install necessary libraries -
- FastAPI -
pip install fastapi
- Uvicorn -
pip install "uvicorn[standard]"
- Azure Exceptions -
pip install azure-core
- Azure Storage -
pip install azure-storage-blob
- FastAPI -
-
Add your Storage Account Connection String in config.ini in variable
conn_str
(Line 2) -
Add your Container Name in config.ini in variable
container
(Line 3) -
In terminal change directory to where main.py is present, execute command
uvicorn main:app --reload
Note: If error is thrown, try command
python -m uvicorn main:app --reload
-
API is running, use URL
http://127.0.0.1:8000
to interact with API
Files downloaded are by default stored in Downloads/
.
Downloads directory can be changed by changing the downloadsPath
in config.ini (Line 20).
Note: If you change the path, make sure following directory already exists to prevent errors
Operation Logs by default are stored in CloudAPILogs.txt
.
Log file name can be changed by chaning the variable logFileName
in config.ini (Line 16).
You can also add log file into a directory by changeing name to [directory_name]/[log_file_name].txt
.
Note: Make sure directory already exists in system to prevent error
-
Uploading Blob -
http://127.0.0.1:8000/upload/C:/Users/Username/Downloads/data.csv
-
Delete Blob -
http://127.0.0.1:8000/delete/data.csv
-
Download Blob -
http://127.0.0.1:8000/download/data.csv
-
Generate List of Blobs -
http://127.0.0.1:8000/list
- Config File
- User Authentication
- Blob Name increment for blobs with same names
- FastAPI Documentation
- Storing Logs in Cloud