Skip to main content

Official Python SDK for Objective, Inc. APIs

Project description

Objective, Inc. Python Library

This is the official python library for the Objective APIs. It provides convenient methods for using Objective's APIs.

Documentation

Our documentation can be found at https://objective.inc/docs.

Installation

pip install objective-sdk

Usage

To get an API key, create an account at https://app.objective.inc.

Add your objects to the object store

from objective import ObjectiveClient
import os

OBJECTIVE_API_KEY = os.environ.get("OBJECTIVE_API_KEY")

client = ObjectiveClient(OBJECTIVE_API_KEY)

# Add an object to the object store
client.object_store.upsert(
    id="1",
    object={
        "title": "Sevendayz Men's Shady Records Eminem Hoodie Hoody Black Medium",
        "brand": "sevendayz",
        "imageURLHighRes": [
            "https://images-na.ssl-images-amazon.com/images/I/41gMYeiNASL.jpg"
        ],
    },
)

Create an index

index = client.create_index(
    template_name="text-neural-base", fields={"searchable": ["title", "brand"]}
)

Check indexing status

index.status()
{"PENDING": 0, "PROCESSING": 1, "PROCESSED": 0, "LIVE": 0, "ERROR": 0}

Search

index.search(query="rapper hoodies", object_fields="*")
{
    "results": [
        {
            "id": 1,
            "object": {"title": "Sevendayz Men's Shady Records Eminem Hoodie Hoody Black Medium", "brand": "sevendayz", "imageURLHighRes": ["https://images-na.ssl-images-amazon.com/images/I/41gMYeiNASL.jpg"]}
        }
    ],
    "pagination": {
        "pages": 1,
        "page": 1,
        "next": null
    }
}

Development

Use python build to build this package:

python -m pip install --upgrade pip

# Install dependencies
pip install .

# Build package:
pip install build
python -m build

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

objective_sdk-2.0.1.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

objective_sdk-2.0.1-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file objective_sdk-2.0.1.tar.gz.

File metadata

  • Download URL: objective_sdk-2.0.1.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for objective_sdk-2.0.1.tar.gz
Algorithm Hash digest
SHA256 674bca3206b3e3f2a78110e16fbcb01a9215085fc14fcd88f499b6f7db2b526b
MD5 b8532a8b2f85349cf2674790a508e210
BLAKE2b-256 aee18af6339644cc050d689714064a9292a622a89235dcafa4537b3979f7020b

See more details on using hashes here.

File details

Details for the file objective_sdk-2.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for objective_sdk-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c4eb16faeb940802ad318dfa05b1a030dc12683dedcef12728f59662f3c226fd
MD5 18bf375465dcebcb2dc5eed2a5a0fc08
BLAKE2b-256 fdbc10526e285a7790917afd368e296b0fb198337ebef7c4aab68c27f35d2ff9

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