Skip to main content

Megaparse SDK

Project description

MegaParse SDK

Welcome to the MegaParse SDK! This SDK allows you to easily interact with the MegaParse API to upload URLs and files for processing.

Installation

To install the MegaParse SDK, use pip:

pip install megaparse-sdk

Usage

Here is an example of how to use the MegaParse SDK:

Uploading URLs

import asyncio
import os

from megaparse.sdk import MegaParseSDK

async def upload_url():
    api_key = str(os.getenv("MEGAPARSE_API_KEY"))
    megaparse = MegaParseSDK(api_key)

    url = "https://www.quivr.com"

    # Upload a URL
    url_response = await megaparse.url.upload(url)
    print(f"\n----- URL Response : {url} -----\n")
    print(url_response)

    await megaparse.close()

if __name__ == "__main__":
    asyncio.run(upload_url())

Uploading Files

import asyncio
import os

from megaparse.sdk import MegaParseSDK

async def upload_file():
    api_key = str(os.getenv("MEGAPARSE_API_KEY"))
    megaparse = MegaParseSDK(api_key)

    file_path = "your/file/path.pdf"
    # Upload a file
    response = await megaparse.file.upload(
        file_path=file_path,
        method="unstructured",  # unstructured, llama_parser, megaparse_vision
        strategy="auto",
    )
    print(f"\n----- File Response : {file_path} -----\n")
    print(response)

    await megaparse.close()

if __name__ == "__main__":
    asyncio.run(upload_file())

Features

  • Upload URLs: Easily upload URLs for processing.
  • Upload Files: Upload files with different processing methods and strategies.

Getting Started

  1. Set up your API key: Make sure to set the MEGAPARSE_API_KEY environment variable with your MegaParse API key.
  2. Run the example: Use the provided example to see how to upload URLs and files.

For more details, refer to the usage example.

We hope you find the MegaParse SDK useful for your projects!

Enjoy, Quivr Team !

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

megaparse_sdk-0.1.1.tar.gz (343.0 kB view details)

Uploaded Source

Built Distribution

megaparse_sdk-0.1.1-py2.py3-none-any.whl (3.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file megaparse_sdk-0.1.1.tar.gz.

File metadata

  • Download URL: megaparse_sdk-0.1.1.tar.gz
  • Upload date:
  • Size: 343.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for megaparse_sdk-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b35d0433338d6240b256e0b713a1ca32e296ec215217ec49ad779557f0a73ebf
MD5 170940a7ce5b3c164ed8b5f9d7c3a7df
BLAKE2b-256 b027700169d294177b39b5d0209d880c2e42eb2c9fca7c5a7552b260bd888608

See more details on using hashes here.

File details

Details for the file megaparse_sdk-0.1.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for megaparse_sdk-0.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 87a7b6bd7d68e4a3eef523453e982a4ec7f32c5d8fd2eb9c875eba8184ddc87f
MD5 1ccf96281d14ffcd349de8da0c4f98d7
BLAKE2b-256 613ba8012deaa7962a4e2374e822c55dfbfcf290794322e6c4c387f354ee36c7

See more details on using hashes here.

Supported by

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