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.0.6.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.0.6-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file njmtech_upload_blob-0.0.6.tar.gz.

File metadata

  • Download URL: njmtech_upload_blob-0.0.6.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.0.6.tar.gz
Algorithm Hash digest
SHA256 4b911adc1b60300d19e1ceaec5270352b4ab1cbc8adfb71d5a6553969ed2d611
MD5 d16d583e223b47b5f6fb563d16c16934
BLAKE2b-256 286929f68f0e78e1b0a1b07458bea248ea867648fc8c114fafd06fe4e9818035

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for njmtech_upload_blob-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 554d44f60cda2d66ca5132ca05610f326b0b1a6ce156855326c20dbfe6236af8
MD5 5e068cf9e5661cca648de50b5fb1e3f4
BLAKE2b-256 d4d65f76e079f9dc0fa8c42296d66db5c46841803c374200d7899bd83047cb19

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