An API client for Swiftype Enterprise
Project description
About
A Python client for interacting with Swiftype Enterprise content sources. Documentation for this API client can be found at Readthedocs (http://swiftype-enterprise.readthedocs.io/en/latest/).
For more information, go to our official documentation page (https://app.swiftype.com/ent/docs/custom_sources).
Installation
Swiftype Enterprise Client can be installed with pip:
$ python -m pip install swiftype_enterprise
You can also download the project source and do:
$ python setup.py install
Dependencies
Swiftype Enterprise Client supports Python 2.7 and Python 3.3+. It depends on futures and requests.
Examples
Here’s a basic example for indexing a document into a custom content source. You can get an access token and a content source key after creating a content source here: https://app.swiftype.com/ent/sources/custom/new
from swiftype_enterprise import SwiftypeEnterpriseClient
from swiftype_enterprise.exceptions import SynchronousDocumentIndexingFailed
content_source_key = 'content source key'
authorization_token = 'authorization token'
client = SwiftypeEnterpriseClient(authorization_token)
documents = [
{
'external_id': '1234',
'url': 'https://github.com/swiftype/swiftype-enterprise-python',
'title': 'Swiftype Enterprise Python Github',
'body': 'A descriptive body, with document contents and metadata'
}
]
try:
document_receipts = client.index_documents(content_source_key, documents, timeout=10, delay=2)
print(document_receipt_ids)
except SynchronousDocumentIndexingFailed:
# Timed out before documents could finish indexing
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
Hashes for swiftype_enterprise-0.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3eafec0212f2fb2671475d0ea0eabd68a50562e86039eb5a4391304ac4e6e5fd |
|
MD5 | 5792ff744dc99d0b063ba85bf42ddfcf |
|
BLAKE2b-256 | 94b6277e2f362a5e2f52cba4f7a494526a74f3597982cbea29a0ab5b38393574 |