Skip to main content

csrf-sentry

PyPI version License: MIT Downloads LinkedIn

A Python package that helps developers implement CSRF (Cross-Site Request Forgery) protection without relying on traditional tokens or hidden form fields. The package takes a user's input describing their web application's structure and security requirements, and returns a structured response with a tailored CSRF protection strategy.

Installation

pip install csrf_sentry

Usage

Basic Usage

from csrf_sentry import csrf_sentry

# Basic usage with default LLM
response = csrf_sentry("Describe your web application structure and security requirements")
print(response)

Using Custom LLM

You can use any Langchain-compliant LLM with csrf_sentry:

OpenAI

from langchain_openai import ChatOpenAI
from csrf_sentry import csrf_sentry

llm = ChatOpenAI()
response = csrf_sentry(user_input, llm=llm)

Anthropic

from langchain_anthropic import ChatAnthropic
from csrf_sentry import csrf_sentry

llm = ChatAnthropic()
response = csrf_sentry(user_input, llm=llm)

Google

from langchain_google_genai import ChatGoogleGenerativeAI
from csrf_sentry import csrf_sentry

llm = ChatGoogleGenerativeAI()
response = csrf_sentry(user_input, llm=llm)

Using Custom API Key

If you need to use your own LLM7 API key:

from csrf_sentry import csrf_sentry

# Pass API key directly
response = csrf_sentry(user_input, api_key="your_api_key_here")

# Or set environment variable
import os
os.environ["LLM7_API_KEY"] = "your_api_key_here"
response = csrf_sentry(user_input)

Parameters

  • user_input (str): The user input text describing your web application structure and security requirements
  • llm (Optional[BaseChatModel]): A Langchain LLM instance. If not provided, defaults to ChatLLM7
  • api_key (Optional[str]): API key for LLM7. If not provided, uses the environment variable LLM7_API_KEY or the default free tier

Getting an API Key

You can get a free API key for LLM7 by registering at https://token.llm7.io/

Default LLM

The package uses ChatLLM7 from langchain_llm7 by default. The free tier rate limits are sufficient for most use cases of this package. If you need higher rate limits, you can provide your own API key.

Support

For issues and questions, please visit our GitHub issues page

Author

Metadata

Release files for csrf-sentry 2025.12.21200926

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for csrf-sentry 2025.12.21200926
File Size Uploaded
csrf_sentry-2025.12.21200926.tar.gz 6.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for csrf-sentry 2025.12.21200926
File Interpreter ABI Platform
csrf_sentry-2025.12.21200926-py3-none-any.whl Python 3 none any Details

Total release size: 12.8 kB

Release files / csrf_sentry-2025.12.21200926.tar.gz

Download URL csrf_sentry-2025.12.21200926.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
4180cbc257da3e709d4004923d1ad8495b3f39a977926a381eac801cb81a8f3a
BLAKE2b-256 checksum
How to use checksums
f762c0adc46af06b6d80ccf24fbb8560f3611933e7dcb4d80ef3cbf4d1fd300c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.1

Release files / csrf_sentry-2025.12.21200926-py3-none-any.whl

Download URL csrf_sentry-2025.12.21200926-py3-none-any.whl
Size 6.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d980236ae627987cc23b63bc72921244ade2684b77eb3f36c97f19a6900dee7b
BLAKE2b-256 checksum
How to use checksums
32dac9fd6ee9dc0f542e5a8aaf0012de2690d671b51ee9dbe73b0e10e018cd95
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.1

Release history Release notifications | RSS feed

This release

2025.12.21200926 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page