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

Uploaded Source

Built Distribution

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

megaparse_sdk-0.1.8-py2.py3-none-any.whl (11.4 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

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

File hashes

Hashes for megaparse_sdk-0.1.8.tar.gz
Algorithm Hash digest
SHA256 a9ae54e0c02282aec12b8cb9d6ebbed775c223673ff34baa715fec4994862a41
MD5 885884ad28c5e02cc7871144ad47d8ec
BLAKE2b-256 dd7664e8a0c0c4386c5370abbb3d1df4af03f1126e46cc6fe155898d6fc888aa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: megaparse_sdk-0.1.8-py2.py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.8

File hashes

Hashes for megaparse_sdk-0.1.8-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 4072ecef800e33ae3a0f281804c81a3ca32580d69a4a3ddd4d191721af771f9f
MD5 26b3a5a2e5bd562d97c89b0f6ef96278
BLAKE2b-256 7d7893d4eb6eade180daebb19e13b4985dc7606d83a97533edcc6e52c62aeeb9

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