seclm
Project description
SecLM library
This library provides convenient access to pin an SSL certificate to a specific pubkey.
Installation
pip install seclm
Usage
Here are some examples of using it in different libraries.
# specify url and sha256
from seclm.ssl import create_ssl_context
ssl_context = create_ssl_context("https://example.seclm.com", "9e69296bf68815839e2cf5c324318f304ba8a7de2f587245c0cb75f54e3fe196")
# httpx
import httpx
httpx.get("https://example.seclm.com", verify=ssl_context)
# aiohttp
import asyncio
import aiohttp
async def main():
async with aiohttp.ClientSession() as session:
async with session.get("https://example.seclm.com", ssl=ssl_context) as response:
await response.text()
asyncio.run(main())
# openai
from openai import OpenAI, DefaultHttpxClient
client = OpenAI(
api_key="EMPTY",
base_url="https://example.seclm.com/v1",
http_client=DefaultHttpxClient(verify=ssl_context)
)
chat_completion = client.chat.completions.create(
messages=[
{
"role": "user",
"content": "Say this is a test",
}
],
model="meta-llama/Meta-Llama-3-8B-Instruct",
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
seclm-0.1.1.tar.gz
(2.2 kB
view hashes)
Built Distribution
seclm-0.1.1-py3-none-any.whl
(2.6 kB
view hashes)