Skip to main content

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 .env file.
  • 🛠️ 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

  1. Install dependencies:

    pip install -r requirements.txt
    
  2. Set up environment variables:

    Create a .env.local file 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.

  3. 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:

  1. Install test dependencies:

    pip install -r tests/requirements.txt
    
  2. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

njmtech_upload_blob-0.1.1.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

njmtech_upload_blob-0.1.1-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

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

Hashes for njmtech_upload_blob-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e080e0385faf3e2cc9fffa86f303b80c12067de03f42dfe51e4e393a542bc74d
MD5 fe359dd1558552f6e58e1f658186bb14
BLAKE2b-256 ac036060d1f067b1beb5ff0f19ce3f89dc33b4046cf8a9796ca47994571d349f

See more details on using hashes here.

File details

Details for the file njmtech_upload_blob-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for njmtech_upload_blob-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3c262c5e3732638edab54e107025e341d47765f95a41601dc1933582030fc354
MD5 bf4fd743cc281fc9ec8cb97646702097
BLAKE2b-256 e0ab3eb41780829edc2fb8248d040c9070d586edec80e481cdf46653c772347c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page