semvec/pypi-packages huggingface dataset:
cloudstile 2.0.1
Unofficial Cloudflare Turnstile library for Python with async and sync support.
License: MIT
Requires Python: <4.0,>=3.9
Keywords: cloudflare, turnstile, captcha

# `⛅` Cloudstile
An unofficial Cloudflare Turnstile library with both asynchronous and synchronous support out of the box.

[![codecov](https://codecov.io/github/NotAussie/cloudstile/branch/main/graph/badge.svg?token=6VKWB9GXEU)](https://codecov.io/github/NotAussie/cloudstile) [![Tests](https://github.com/NotAussie/cloudstile/actions/workflows/tests.yml/badge.svg)](https://github.com/NotAussie/cloudstile/actions/workflows/tests.yml) [![Pylint](https://github.com/NotAussie/cloudstile/actions/workflows/pylint.yml/badge.svg)](https://github.com/NotAussie/cloudstile/actions/workflows/pylint.yml) [![Mypy](https://github.com/NotAussie/cloudstile/actions/workflows/mypy.yml/badge.svg)](https://github.com/NotAussie/cloudstile/actions/workflows/mypy.yml)

## `📥` Installation
**Cloudstile** is available for download via PyPI. To install it, simply do:
```shell
pip install cloudstile
```

## `🎭` Example

Here are some basic examples of how to validate a user's turnstile token.

> [!WARNING]
> These examples expect the user's IP to be transparent. If you're using something like Cloudflare's proxy service, then you'll need to access the corresponding header for your use case.

### `🍷` Quart *(Asynchronous)*

```python
from quart import Quart, request, jsonify
from cloudstile import AsyncTurnstile

app = Quart(__name__)
turnstile = AsyncTurnstile(token="...")

@app.route("/submit", methods=["POST"])
async def submit():

    body = await request.form

    response = await turnstile.validate(
        body.get("cf-turnstile-response", "..."),
        request.remote_addr,
    )

    return jsonify(response.model_dump()) # <- Response is a pydantic object

```

### `🏃‍♀️` FastAPI *(Asynchronous)*

```python
from fastapi import FastAPI, Request
from fastapi.responses import JSONResponse
from cloudstile import AsyncTurnstile

app = FastAPI()
turnstile = AsyncTurnstile(token="...")

@app.post("/submit")
async def submit(request: Request):

    body = await request.form()

    response = await turnstile.validate(
        body.get("cf-turnstile-response", "..."),
        request.client.host,
    )

    return JSONResponse(response.model_dump()) # <- Response is a pydantic object

```


### `🦥` Flask *(Synchronous)*

```python
from flask import Flask, request, jsonify
from cloudstile import SyncTurnstile

app = Flask(__name__)
turnstile = SyncTurnstile(token="...")

@app.route("/submit", methods=["POST"])
def submit():

    body = request.form

    response = turnstile.validate(
        body.get("cf-turnstile-response", "..."),
        request.remote_addr,
    )

    return jsonify(response.model_dump()) # <- Response is a pydantic object

```
llmvision 0.1.1
Visualize how LLMs tokenize text
License: MIT
Requires Python: >=3.10
Keywords: gpt, llm, nlp, tokenization, tokenizer, visualization

# LLMVision

Visualize how LLMs tokenize text.

```python
from llmvision import tokenize_and_visualize, GPT4Tokenizer

text = "Hello world! 👋🌍"
print(tokenize_and_visualize(text, GPT4Tokenizer()))
# Output: Hello│ world│!│<bytes:20f09f>│<bytes:91>│<bytes:8b>│<bytes:f09f>│<bytes:8c>│<bytes:8d>
```

## Features

- Multiple tokenizers: GPT-2, GPT-4, byte-level, character-level
- Visual token boundaries  
- Unicode/emoji handling
- Actual tokenization used by OpenAI models

## Installation

```bash
pip install llmvision
```

## Usage

```bash
llmvision "Hello world!"
llmvision "Hello world!" --tokenizer gpt4
llmvision "Hello world!" --indices
```

```python
from llmvision import tokenize_and_visualize, GPT4Tokenizer

# Default tokenizer
print(tokenize_and_visualize("Hello world!"))

# Specific tokenizer
print(tokenize_and_visualize("Hello world!", GPT4Tokenizer()))
```

## Examples

```python
from llmvision import GPT4Tokenizer

tokenizer = GPT4Tokenizer()
tokens = tokenizer.tokenize("Hello world!")
print(tokens)  # ['Hello', ' world', '!']
```

## Tokenizers

- `SimpleTokenizer` - word/punctuation/space
- `WordTokenizer` - whitespace-based
- `CharTokenizer` - character-level
- `GraphemeTokenizer` - Unicode grapheme clusters
- `ByteLevelTokenizer` - UTF-8 bytes
- `GPT2Tokenizer` - GPT-2 (via tiktoken)
- `GPT4Tokenizer` - GPT-4 (via tiktoken)
- `SubwordTokenizer` - basic subword splitting

## Token Costs

```python
tokenizer = GPT4Tokenizer()
examples = [
    "Hello world!",    # 3 tokens
    "Hello 世界!",     # 5 tokens  
    "Hello 👋🌍!",     # 8 tokens
    "👨‍👩‍👧‍👦",            # 18 tokens
]
for text in examples:
    print(f"{text:15} → {len(tokenizer.tokenize(text))} tokens")
```

## License

MIT
bed-solution-api 0.1.1
API for bed solution capston project
License: MIT
Requires Python: >=3.9

# Bed Solution API

침대 압력 모니터링 솔루션을 위한 API 라이브러리입니다.

## 설정

API를 사용하기 전에 `.env` 파일을 프로젝트 루트 디렉토리에 생성하고 다음 환경 변수들을 설정해야 합니다:

```env
# 서버 API 설정 (필수)
API_KEY=your_api_key_here
API_URL=https://your-api-server.com

# 로깅 설정
ENABLE_DEBUGGING=False
ENABLE_LOG_CONSOLE=True
ENABLE_LOG_FILE=True
LOG_DIR_PATH=./logs

# 압력 데이터 전송 간격 (분 단위)
MIN_INTERVAL=5
```

### 환경 변수 설명

| 변수명 | 필수 여부 | 설명 | 기본값 | 예시 |
|--------|----------|------|--------|------|
| `API_KEY` | 필수 | 서버 API 인증 키 | - | `abc123xyz789` |
| `API_URL` | 필수 | 서버 API 엔드포인트 URL | - | `https://api.bedsolution.com` |
| `ENABLE_DEBUGGING` | 선택 | 디버깅 모드 활성화 여부 | `False` | `True` 또는 `False` |
| `ENABLE_LOG_CONSOLE` | 선택 | 콘솔 로그 출력 활성화 여부 | `True` | `True` 또는 `False` |
| `ENABLE_LOG_FILE` | 선택 | 파일 로그 저장 활성화 여부 | `True` | `True` 또는 `False` |
| `LOG_DIR_PATH` | 선택 | 로그 파일 저장 디렉토리 경로 | `./logs` | `./logs` 또는 `/var/log/bedsolution` |
| `MIN_INTERVAL` | 선택 | 압력 데이터 전송 최소 간격 (분) | `30` | `30`, `60`, `120` |

## 사용법

```python
from bed_solution_api import BedSolutionAPI
from pressure_info import PressureInfo

# API 인스턴스 생성
api = BedSolutionAPI()

# 장비 등록
device_id = api.register_device()

# 압력 정보 기록
pressure_data = PressureInfo(occipu=50, scapula=60, elbow=30, hip=80)
api.record_pressure_info(pressure_data)

# 서버로 데이터 전송
api.send()

# 장비 등록 해제
api.deregister_device()
```