This is a simple FastAPI application to upload files to Vercel Blob storage.
Project description
NJMTech Upload Blob API
Tech Stack
This project is built using the following technologies:
- 🐍 Python: The core programming language.
- ⚡ FastAPI: A modern, fast (high-performance) web framework for building APIs with Python 3.7+ based on standard Python type hints.
- ☁️ Vercel Blob: A serverless, scalable, and cost-efficient object storage solution for the web.
- 🦄 Uvicorn: A lightning-fast ASGI server, used to run the FastAPI application.
- .env python-dotenv: Manages environment variables, loading them from a
.envfile. - 🛠️ Werkzeug: A comprehensive WSGI web application library, used here for secure filename handling.
- 🧪 Pytest: A mature full-featured Python testing framework.
This is a simple FastAPI application to upload files to Vercel Blob storage.
Setup
-
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables:
Create a
.env.localfile in the root of the project and add your Vercel Blob read-write token:BLOB_READ_WRITE_TOKEN="YOUR_BLOB_READ_WRITE_TOKEN"Replace
"YOUR_BLOB_READ_WRITE_TOKEN"with your actual token. -
Run the application:
uvicorn api.main:app --reload
The application will be running at
http://127.0.0.1:8000.
Testing
To run the tests for this project, follow these steps:
-
Install test dependencies:
pip install -r tests/requirements.txt
-
Run the tests:
pytest tests/
API Endpoint
Upload File
- URL:
/api/v1/upload - Method:
POST - Headers:
Authorization: Bearer YOUR_API_TOKEN
- Form Data:
file(the file to upload)
Example using curl:
curl -X POST \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-F "file=@/path/to/your/file.txt" \
http://127.0.0.1:8000/api/v1/upload
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file njmtech_upload_blob-0.1.1.tar.gz.
File metadata
- Download URL: njmtech_upload_blob-0.1.1.tar.gz
- Upload date:
- Size: 10.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e080e0385faf3e2cc9fffa86f303b80c12067de03f42dfe51e4e393a542bc74d
|
|
| MD5 |
fe359dd1558552f6e58e1f658186bb14
|
|
| BLAKE2b-256 |
ac036060d1f067b1beb5ff0f19ce3f89dc33b4046cf8a9796ca47994571d349f
|
File details
Details for the file njmtech_upload_blob-0.1.1-py3-none-any.whl.
File metadata
- Download URL: njmtech_upload_blob-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c262c5e3732638edab54e107025e341d47765f95a41601dc1933582030fc354
|
|
| MD5 |
bf4fd743cc281fc9ec8cb97646702097
|
|
| BLAKE2b-256 |
e0ab3eb41780829edc2fb8248d040c9070d586edec80e481cdf46653c772347c
|