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
- Set up your API key: Make sure to set the
MEGAPARSE_API_KEY
environment variable with your MegaParse API key. - 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.3.tar.gz
(343.0 kB
view details)
Built Distribution
File details
Details for the file megaparse_sdk-0.1.3.tar.gz
.
File metadata
- Download URL: megaparse_sdk-0.1.3.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 192d04d5ec0f6bc294b7c7c5e6350370d46882ade6a31a6f5b09fea9a9ef846b |
|
MD5 | 4c72688766066971a91ce6a21fa2b82a |
|
BLAKE2b-256 | 92f94ae6697a43a21b901a199e068cf3df02384e2b3d1b666bf7674840cc994c |
File details
Details for the file megaparse_sdk-0.1.3-py2.py3-none-any.whl
.
File metadata
- Download URL: megaparse_sdk-0.1.3-py2.py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7399af1fa4b2c0caeb40adb97d7789617841e599d8398a2973e447ca4f1722f3 |
|
MD5 | 12df7b988e4d12237898b4d5ea210b35 |
|
BLAKE2b-256 | da34ffa7457fb4f79a630d996092612f63e9e53e43aee230aaf1501e661978dc |