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.2.tar.gz (343.0 kB view details)

Uploaded Source

Built Distribution

megaparse_sdk-0.1.2-py2.py3-none-any.whl (4.9 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: megaparse_sdk-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 a837523bcf8b6685c5c5dbdad073fafda6ab1bcdb6d1b1aaeba9e8073f0b26e6
MD5 7226038c97d9b1c3ffca48bde527dae2
BLAKE2b-256 ec30db30f4f3333bdd1254b9c111497f498efa33e6f60c98aae9ef290172dbf7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for megaparse_sdk-0.1.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e84337eb7e29f55a734f5037b760066b7edef8a728a39e47eef733f80c6fa395
MD5 975db1eb34f64e6defc6f770f7d04094
BLAKE2b-256 f80518fd31723845c497df251a4ac927f816dea23d056e81ccecbb31b80c2f73

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