privateai / pai-thin-client

A python client used to interact with the Private AI's API
https://docs.private-ai.com/
MIT License
20 stars 1 forks source link

PAIClient does not support x-api-key header #5

Closed jojo-data closed 1 year ago

jojo-data commented 1 year ago

The thin client does not support x-api-key in the header of the request, thus can not be used to send requests to hosted private ai API endpoints

a-guiducci commented 1 year ago

@jojo-data The latest build is in pypi and has the capability to add x-api-key now :) Here's a sample of how to go about it:

Adding Authorization to the Client

from privateai_client import PAIClient
# On initialization
client = PAIClient("http", "localhost", "8080", api_key='testkey')

# After initialization
client = PAIClient("http", "localhost", "8080")
client.add_api_key("testkey")

I'll keep this issue open for a couple days, just in case any unforeseen issues come up

a-guiducci commented 1 year ago

ability to add api key to the header of requests has been added in the latest release