### Unit Testing with Pytest Source: https://context7.com/jobbole/awesome-python-cn/llms.txt Demonstrates basic assertions, parameterized tests, exception handling, and the use of fixtures for setup and teardown in the pytest framework. ```python import pytest def add(a, b): return a + b @pytest.mark.parametrize("a,b,expected", [(2, 3, 5), (0, 0, 0)]) def test_add(a, b, expected): assert add(a, b) == expected @pytest.fixture def sample_data(): return {'users': ['alice'], 'count': 1} def test_with_fixture(sample_data): assert len(sample_data['users']) == sample_data['count'] ``` -------------------------------- ### GET /items/ Source: https://context7.com/jobbole/awesome-python-cn/llms.txt Retrieves a list of all items. Supports pagination with skip and limit parameters. ```APIDOC ## GET /items/ ### Description Retrieves a list of all items. Supports pagination with skip and limit parameters. ### Method GET ### Endpoint /items/ ### Parameters #### Query Parameters - **skip** (int) - Optional - The number of items to skip from the beginning of the list. Defaults to 0. - **limit** (int) - Optional - The maximum number of items to return. Defaults to 10. Maximum allowed is 100. ### Response #### Success Response (200) - **Array of Items**: Each item in the array has the following structure: - **id** (int) - The unique identifier of the item. - **name** (str) - The name of the item. - **price** (float) - The price of the item. - **description** (str) - The description of the item. - **created_at** (datetime) - The timestamp when the item was created. #### Response Example ```json [ { "id": 1, "name": "Example Item 1", "price": 19.99, "description": "This is a sample item.", "created_at": "2023-10-27T10:00:00" }, { "id": 2, "name": "Example Item 2", "price": 29.99, "description": null, "created_at": "2023-10-27T10:05:00" } ] ``` ``` -------------------------------- ### Visualize Data with Matplotlib and Pyecharts Source: https://context7.com/jobbole/awesome-python-cn/llms.txt Provides examples for creating static plots using Matplotlib and interactive web-based charts using Pyecharts. ```python import matplotlib.pyplot as plt import numpy as np from pyecharts.charts import Bar, Pie from pyecharts import options as opts # matplotlib 示例 x = np.linspace(0, 10, 100) plt.plot(x, np.sin(x)) plt.savefig('plot.png') # pyecharts 示例 bar = (Bar().add_xaxis(['A', 'B']).add_yaxis('Sales', [10, 20])) bar.render("bar_chart.html") ``` -------------------------------- ### SQLAlchemy ORM for Database Interaction Source: https://context7.com/jobbole/awesome-python-cn/llms.txt Provides an example of using SQLAlchemy, a powerful SQL toolkit and Object Relational Mapper (ORM) for Python. It demonstrates setting up an engine, defining database models (User and Post) with relationships, creating tables, managing sessions, and performing basic CRUD operations like creating and querying records. ```python # pip install sqlalchemy from sqlalchemy import create_engine, Column, Integer, String, ForeignKey, DateTime from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker, relationship from datetime import datetime # Create engine and base class engine = create_engine('sqlite:///example.db', echo=True) Base = declarative_base() # Define models class User(Base): __tablename__ = 'users' id = Column(Integer, primary_key=True) username = Column(String(50), unique=True, nullable=False) email = Column(String(100), unique=True) created_at = Column(DateTime, default=datetime.utcnow) posts = relationship('Post', back_populates='author') class Post(Base): __tablename__ = 'posts' id = Column(Integer, primary_key=True) title = Column(String(200), nullable=False) content = Column(String) user_id = Column(Integer, ForeignKey('users.id')) author = relationship('User', back_populates='posts') # Create tables Base.metadata.create_all(engine) # Create a session Session = sessionmaker(bind=engine) session = Session() # Create a record user = User(username='alice', email='alice@example.com') session.add(user) session.commit() # Create a related record post = Post(title='Hello World', content='My first post', author=user) session.add(post) session.commit() # Querying all_users = session.query(User).all() user = session.query(User).filter_by(username='alice').first() users = session.query(User).filter(User.email.like('%@example.com')).all() ``` -------------------------------- ### HTTP Client with Requests Library Source: https://context7.com/jobbole/awesome-python-cn/llms.txt Demonstrates how to use the popular 'requests' Python library to make various HTTP requests. Covers GET, POST (with JSON and form data), custom headers, file uploads, timeout handling, exception management, and session management for persistent connections. ```python # pip install requests import requests from requests.auth import HTTPBasicAuth # GET request response = requests.get('https://api.github.com/users/python') print(response.status_code) # 200 print(response.json()) # {'login': 'python', ...} # GET request with parameters params = {'q': 'python', 'sort': 'stars'} response = requests.get('https://api.github.com/search/repositories', params=params) data = response.json() print(f"Found {data['total_count']} repositories") # POST request (JSON data) payload = {'name': 'test', 'value': 123} response = requests.post('https://httpbin.org/post', json=payload) print(response.json()) # POST request (form data) data = {'username': 'user', 'password': 'pass'} response = requests.post('https://httpbin.org/post', data=data) # Custom request headers headers = { 'Authorization': 'Bearer your-token', 'Content-Type': 'application/json' } response = requests.get('https://api.example.com/data', headers=headers) # File upload files = {'file': open('report.pdf', 'rb')} response = requests.post('https://httpbin.org/post', files=files) # Timeout and exception handling try: response = requests.get('https://api.example.com', timeout=5) response.raise_for_status() # Raise an HTTPError for bad responses (4xx or 5xx) except requests.exceptions.Timeout: print("Request timed out") except requests.exceptions.HTTPError as e: print(f"HTTP error: {e}") except requests.exceptions.RequestException as e: print(f"Request failed: {e}") # Session for maintaining state with requests.Session() as session: session.headers.update({'Authorization': 'Bearer token'}) response = session.get('https://api.example.com/user') response = session.get('https://api.example.com/orders') ``` -------------------------------- ### GET /items/{item_id} Source: https://context7.com/jobbole/awesome-python-cn/llms.txt Retrieves the details of a specific item by its ID. ```APIDOC ## GET /items/{item_id} ### Description Retrieves the details of a specific item by its ID. ### Method GET ### Endpoint /items/{item_id} ### Parameters #### Path Parameters - **item_id** (int) - Required - The ID of the item to retrieve. ### Response #### Success Response (200) - **id** (int) - The unique identifier of the item. - **name** (str) - The name of the item. - **price** (float) - The price of the item. - **description** (str) - The description of the item. - **created_at** (datetime) - The timestamp when the item was created. #### Error Response (404) - **detail** (str) - "Item not found" if the item with the specified ID does not exist. #### Response Example ```json { "id": 1, "name": "Example Item", "price": 19.99, "description": "This is a sample item.", "created_at": "2023-10-27T10:00:00" } ``` ``` -------------------------------- ### Create CLI Applications with Click Source: https://context7.com/jobbole/awesome-python-cn/llms.txt Shows how to build robust command-line interfaces using decorators for commands, arguments, options, and flags. ```python import click @click.group() def cli(): pass @cli.command() @click.argument('name') @click.option('--count', default=1) def hello(name, count): for _ in range(count): click.echo(f"Hello, {name}!") if __name__ == '__main__': cli() ``` -------------------------------- ### Logging with Loguru Source: https://context7.com/jobbole/awesome-python-cn/llms.txt Shows how to use the loguru library for simplified logging, including basic levels and file rotation configuration. ```python from loguru import logger logger.info("Info message") logger.error("Error message") # 配置输出到文件 logger.add("app.log", rotation="500 MB", retention="10 days") ``` -------------------------------- ### Manage Configuration with python-decouple Source: https://context7.com/jobbole/awesome-python-cn/llms.txt Demonstrates separating configuration from code by reading environment variables or .env files with type casting support. ```python from decouple import config, Csv DEBUG = config('DEBUG', default=False, cast=bool) SECRET_KEY = config('SECRET_KEY') ALLOWED_HOSTS = config('ALLOWED_HOSTS', cast=Csv()) print(f"Debug mode: {DEBUG}") ``` -------------------------------- ### Configure Logging with Loguru Source: https://context7.com/jobbole/awesome-python-cn/llms.txt Demonstrates advanced logging features including formatting, structured logging, exception handling, context management, filtering, and JSON serialization. ```python from loguru import logger import sys # 配置格式和级别 logger.add( sys.stderr, format="{time:YYYY-MM-DD HH:mm:ss} | {level: <8} | {name}:{function}:{line} - {message}", level="INFO" ) # 结构化日志 logger.info("User logged in", user_id=123, ip="192.168.1.1") # 异常捕获 @logger.catch def risky_function(): return 1 / 0 # 上下文管理 with logger.contextualize(task_id="abc123"): logger.info("Processing task") logger.info("Task completed") # 过滤日志 logger.add("errors.log", filter=lambda record: record["level"].name == "ERROR") # 自定义级别 logger.level("CUSTOM", no=15, color="", icon="*") logger.log("CUSTOM", "Custom level message") # 序列化为 JSON logger.add("json.log", serialize=True) logger.info("JSON log entry", data={"key": "value"}) ``` -------------------------------- ### Execute Machine Learning Pipelines with scikit-learn Source: https://context7.com/jobbole/awesome-python-cn/llms.txt Demonstrates a standard machine learning workflow including data splitting, feature scaling, model training with Logistic Regression, and performance evaluation. ```python from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler from sklearn.linear_model import LogisticRegression from sklearn.metrics import accuracy_score # Data preparation X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2) # Scaling and training scaler = StandardScaler() X_train_scaled = scaler.fit_transform(X_train) lr_model = LogisticRegression() lr_model.fit(X_train_scaled, y_train) # Prediction and evaluation y_pred = lr_model.predict(scaler.transform(X_test)) print(f"Accuracy: {accuracy_score(y_test, y_pred)}") ``` -------------------------------- ### POST /items/ Source: https://context7.com/jobbole/awesome-python-cn/llms.txt Creates a new item with the provided details. The item will be assigned a unique ID and a creation timestamp. ```APIDOC ## POST /items/ ### Description Creates a new item with the provided details. The item will be assigned a unique ID and a creation timestamp. ### Method POST ### Endpoint /items/ ### Parameters #### Request Body - **name** (str) - Required - The name of the item. - **price** (float) - Required - The price of the item. - **description** (str) - Optional - A description of the item. ### Request Example ```json { "name": "Example Item", "price": 19.99, "description": "This is a sample item." } ``` ### Response #### Success Response (200) - **id** (int) - The unique identifier of the created item. - **name** (str) - The name of the item. - **price** (float) - The price of the item. - **description** (str) - The description of the item. - **created_at** (datetime) - The timestamp when the item was created. #### Response Example ```json { "id": 1, "name": "Example Item", "price": 19.99, "description": "This is a sample item.", "created_at": "2023-10-27T10:00:00" } ``` ``` -------------------------------- ### Build Web Scrapers with Scrapy Source: https://context7.com/jobbole/awesome-python-cn/llms.txt Illustrates the structure of a Scrapy project, including defining data items, implementing spider logic for crawling and pagination, and creating pipelines for data export. ```python import scrapy class ArticleItem(scrapy.Item): title = scrapy.Field() url = scrapy.Field() content = scrapy.Field() publish_date = scrapy.Field() class ArticleSpider(scrapy.Spider): name = 'article' allowed_domains = ['example.com'] start_urls = ['https://example.com/articles'] def parse(self, response): for article in response.css('div.article-item'): item = ArticleItem() item['title'] = article.css('h2.title::text').get() item['url'] = article.css('a::attr(href)').get() yield response.follow(item['url'], callback=self.parse_detail, meta={'item': item}) next_page = response.css('a.next-page::attr(href)').get() if next_page: yield response.follow(next_page, callback=self.parse) def parse_detail(self, response): item = response.meta['item'] item['content'] = response.css('div.content::text').getall() item['publish_date'] = response.css('span.date::text').get() yield item ``` -------------------------------- ### Python 包管理 - pip 和 pipenv Source: https://context7.com/jobbole/awesome-python-cn/llms.txt pip 是 Python 的官方包管理器,用于安装和管理库。pipenv 是一个更现代化的工具,它结合了 pip 和 virtualenv 的功能,并使用 Pipfile 管理项目依赖,推荐用于新项目。 ```bash # pip 基本用法 pip install requests pip install requests==2.28.0 pip install -r requirements.txt pip freeze > requirements.txt pip uninstall requests # pipenv 创建虚拟环境并安装依赖 pipenv install pipenv install requests pipenv install pytest --dev # 激活虚拟环境 pipenv shell # 运行命令(无需激活环境) pipenv run python app.py # 生成 requirements.txt pipenv requirements > requirements.txt # Pipfile 示例 # [[source]] # url = "https://pypi.org/simple" # verify_ssl = true # name = "pypi" # # [packages] # requests = "*" # flask = ">=2.0" # # [dev-packages] # pytest = "*" ``` -------------------------------- ### 管理 Python 版本 - pyenv Source: https://context7.com/jobbole/awesome-python-cn/llms.txt pyenv 是一个用于在同一系统上安装和切换多个 Python 版本的工具。它允许用户轻松管理不同的 Python 环境,通过简单的命令即可实现版本的全局或局部设置。 ```bash # 安装 pyenv curl https://pyenv.run | bash # 列出所有可安装的 Python 版本 pyenv install --list # 安装指定版本的 Python pyenv install 3.11.0 # 设置全局 Python 版本 pyenv global 3.11.0 # 设置当前目录的本地 Python 版本 pyenv local 3.10.0 # 查看当前使用的 Python 版本 pyenv version # 输出: 3.11.0 (set by /home/user/.pyenv/version) ``` -------------------------------- ### Flask Web 框架 - 路由、API 和装饰器 Source: https://context7.com/jobbole/awesome-python-cn/llms.txt Flask 是一个轻量级的 Python Web 微框架。此代码展示了如何创建基本路由、带参数的路由、RESTful API 端点(GET, POST, PUT, DELETE),以及如何使用装饰器实现简单的请求认证。 ```python # pip install flask from flask import Flask, request, jsonify, render_template from functools import wraps app = Flask(__name__) # 简单路由 @app.route('/') def index(): return 'Hello, World!' # 带参数的路由 @app.route('/user/') def show_user(username): return f'User: {username}' # RESTful API 示例 users = {} @app.route('/api/users', methods=['GET', 'POST']) def handle_users(): if request.method == 'GET': return jsonify(list(users.values())) elif request.method == 'POST': data = request.get_json() user_id = len(users) + 1 users[user_id] = {'id': user_id, **data} return jsonify(users[user_id]), 201 @app.route('/api/users/', methods=['GET', 'PUT', 'DELETE']) def handle_user(user_id): if user_id not in users: return jsonify({'error': 'User not found'}), 404 if request.method == 'GET': return jsonify(users[user_id]) elif request.method == 'PUT': data = request.get_json() users[user_id].update(data) return jsonify(users[user_id]) elif request.method == 'DELETE': del users[user_id] return '', 204 # 装饰器示例 - 简单认证 def require_auth(f): @wraps(f) def decorated(*args, **kwargs): auth = request.headers.get('Authorization') if not auth or auth != 'Bearer secret-token': return jsonify({'error': 'Unauthorized'}), 401 return f(*args, **kwargs) return decorated @app.route('/api/protected') @require_auth def protected(): return jsonify({'message': 'This is protected data'}) if __name__ == '__main__': app.run(debug=True) ``` -------------------------------- ### Perform Data Analysis with Pandas Source: https://context7.com/jobbole/awesome-python-cn/llms.txt Covers essential Pandas operations such as DataFrame creation, file I/O, data selection, filtering, aggregation, and handling missing values. ```python import pandas as pd data = {'name': ['Alice', 'Bob'], 'age': [25, 30], 'salary': [10000, 15000]} df = pd.DataFrame(data) # Basic operations print(df.describe()) filtered_df = df[df['age'] > 28] # Grouping and aggregation grouped = df.groupby('city').agg({'salary': ['mean', 'sum']}) # Saving data df.to_csv('output.csv', index=False) ``` -------------------------------- ### Distributed Task Queue with Celery Source: https://context7.com/jobbole/awesome-python-cn/llms.txt Configures a Celery application with Redis as a broker, demonstrating task definition, retries, chaining, and periodic task scheduling. ```python from celery import Celery, chain app = Celery('tasks', broker='redis://localhost:6379/0', backend='redis://localhost:6379/0') @app.task def add(x, y): return x + y @app.task(bind=True, max_retries=3) def fetch_url(self, url): try: import requests return requests.get(url).status_code except Exception as exc: raise self.retry(exc=exc, countdown=60) # 链式任务 result = chain(add.s(2, 2), add.s(4))() ``` -------------------------------- ### FastAPI Web 框架 - 基础设置 Source: https://context7.com/jobbole/awesome-python-cn/llms.txt FastAPI 是一个现代、高性能的 Python Web 框架,基于标准 Python 类型注解。此代码片段展示了 FastAPI 应用的基本初始化,包括设置标题和版本号。 ```python # pip install fastapi uvicorn from fastapi import FastAPI, HTTPException, Depends, Query from pydantic import BaseModel from typing import List, Optional from datetime import datetime app = FastAPI(title="My API", version="1.0.0") ``` -------------------------------- ### Machine Learning Model Evaluation and Feature Importance Source: https://context7.com/jobbole/awesome-python-cn/llms.txt Demonstrates how to perform cross-validation on a linear model, train a Random Forest classifier, and extract feature importance scores using scikit-learn and pandas. ```python from sklearn.model_selection import cross_val_score from sklearn.ensemble import RandomForestClassifier from sklearn.metrics import accuracy_score import pandas as pd # 交叉验证 scores = cross_val_score(lr_model, X_train_scaled, y_train, cv=5) print(f"\n交叉验证准确率: {scores.mean():.4f} (+/- {scores.std() * 2:.4f})") # 随机森林模型 rf_model = RandomForestClassifier(n_estimators=100, random_state=42) rf_model.fit(X_train, y_train) rf_pred = rf_model.predict(X_test) print(f"\n随机森林准确率: {accuracy_score(y_test, rf_pred):.4f}") # 特征重要性 feature_importance = pd.DataFrame({ 'feature': iris.feature_names, 'importance': rf_model.feature_importances_ }).sort_values('importance', ascending=False) print("\n特征重要性:") print(feature_importance) ``` -------------------------------- ### Natural Language Processing with Jieba Source: https://context7.com/jobbole/awesome-python-cn/llms.txt Covers Chinese text segmentation using different modes (precise, full, search), keyword extraction via TF-IDF and TextRank, and part-of-speech tagging. ```python import jieba import jieba.analyse import jieba.posseg as pseg text = "我来到北京清华大学" # 分词模式 print("精确模式:", "/".join(jieba.cut(text, cut_all=False))) print("全模式:", "/".join(jieba.cut(text, cut_all=True))) print("搜索引擎模式:", "/".join(jieba.cut_for_search(text))) # 关键词提取 content = "Python是一种广泛使用的编程语言。" keywords = jieba.analyse.extract_tags(content, topK=5) # 词性标注 words = pseg.cut("我爱北京天安门") for word, flag in words: print(f"{word}/{flag}") ``` -------------------------------- ### Perform SQLAlchemy Database Operations Source: https://context7.com/jobbole/awesome-python-cn/llms.txt Demonstrates basic ORM operations including querying related models, updating record attributes, and deleting entries within a database session. ```python user_with_posts = session.query(User).filter_by(username='alice').first() for post in user_with_posts.posts: print(f"{post.title}: {post.content}") user.email = 'new_email@example.com' session.commit() session.delete(post) session.commit() session.close() ``` -------------------------------- ### Django Web 框架 - 模型、视图和 URL Source: https://context7.com/jobbole/awesome-python-cn/llms.txt Django 是一个流行的 Python 全栈 Web 框架。此代码示例展示了如何定义 Django 模型(`models.py`)、创建视图函数(`views.py`)来处理请求和渲染模板,以及配置 URL 路由(`urls.py`)。 ```python # 安装 Django # pip install django # 创建项目和应用 # django-admin startproject myproject # cd myproject # python manage.py startapp myapp # models.py - 定义数据模型 from django.db import models class Article(models.Model): title = models.CharField(max_length=200) content = models.TextField() created_at = models.DateTimeField(auto_now_add=True) published = models.BooleanField(default=False) class Meta: ordering = ['-created_at'] def __str__(self): return self.title # views.py - 视图函数 from django.shortcuts import render, get_object_or_404 from django.http import JsonResponse from .models import Article def article_list(request): articles = Article.objects.filter(published=True) return render(request, 'articles/list.html', {'articles': articles}) def article_detail(request, pk): article = get_object_or_404(Article, pk=pk) return render(request, 'articles/detail.html', {'article': article}) def api_articles(request): articles = Article.objects.filter(published=True).values('id', 'title', 'created_at') return JsonResponse(list(articles), safe=False) # urls.py - URL 路由配置 from django.urls import path from . import views urlpatterns = [ path('articles/', views.article_list, name='article_list'), path('articles//', views.article_detail, name='article_detail'), path('api/articles/', views.api_articles, name='api_articles'), ] ``` -------------------------------- ### FastAPI Item CRUD Operations Source: https://context7.com/jobbole/awesome-python-cn/llms.txt Implements Create, Read, Update, and Delete operations for 'Item' resources using FastAPI. It defines Pydantic models for request and response, simulates a database with a dictionary, and handles item creation, listing, retrieval, update, and deletion. Includes API documentation endpoints. ```python from fastapi import FastAPI, HTTPException, Query from pydantic import BaseModel from typing import Optional, List from datetime import datetime class ItemCreate(BaseModel): name: str price: float description: Optional[str] = None class Item(ItemCreate): id: int created_at: datetime class Config: orm_mode = True app = FastAPI() items_db: dict[int, Item] = {} @app.post("/items/", response_model=Item) async def create_item(item: ItemCreate): item_id = len(items_db) + 1 db_item = Item(id=item_id, created_at=datetime.now(), **item.dict()) items_db[item_id] = db_item return db_item @app.get("/items/", response_model=List[Item]) async def list_items( skip: int = Query(0, ge=0), limit: int = Query(10, ge=1, le=100) ): return list(items_db.values())[skip:skip + limit] @app.get("/items/{item_id}", response_model=Item) async def get_item(item_id: int): if item_id not in items_db: raise HTTPException(status_code=404, detail="Item not found") return items_db[item_id] @app.put("/items/{item_id}", response_model=Item) async def update_item(item_id: int, item: ItemCreate): if item_id not in items_db: raise HTTPException(status_code=404, detail="Item not found") db_item = items_db[item_id] update_data = item.dict(exclude_unset=True) updated_item = db_item.copy(update=update_data) items_db[item_id] = updated_item return updated_item @app.delete("/items/{item_id}") async def delete_item(item_id: int): if item_id not in items_db: raise HTTPException(status_code=404, detail="Item not found") del items_db[item_id] return {"message": "Item deleted"} # Run: uvicorn main:app --reload # API Docs: http://localhost:8000/docs ``` -------------------------------- ### DELETE /items/{item_id} Source: https://context7.com/jobbole/awesome-python-cn/llms.txt Deletes an item identified by its ID. ```APIDOC ## DELETE /items/{item_id} ### Description Deletes an item identified by its ID. ### Method DELETE ### Endpoint /items/{item_id} ### Parameters #### Path Parameters - **item_id** (int) - Required - The ID of the item to delete. ### Response #### Success Response (200) - **message** (str) - "Item deleted" indicating successful deletion. #### Error Response (404) - **detail** (str) - "Item not found" if the item with the specified ID does not exist. #### Response Example ```json { "message": "Item deleted" } ``` ``` -------------------------------- ### PUT /items/{item_id} Source: https://context7.com/jobbole/awesome-python-cn/llms.txt Updates an existing item identified by its ID. Only the fields provided in the request body will be updated. ```APIDOC ## PUT /items/{item_id} ### Description Updates an existing item identified by its ID. Only the fields provided in the request body will be updated. ### Method PUT ### Endpoint /items/{item_id} ### Parameters #### Path Parameters - **item_id** (int) - Required - The ID of the item to update. #### Request Body - **name** (str) - Optional - The updated name of the item. - **price** (float) - Optional - The updated price of the item. - **description** (str) - Optional - The updated description of the item. ### Request Example ```json { "price": 25.50, "description": "Updated description for the item." } ``` ### Response #### Success Response (200) - **id** (int) - The unique identifier of the updated item. - **name** (str) - The name of the item. - **price** (float) - The price of the item. - **description** (str) - The description of the item. - **created_at** (datetime) - The timestamp when the item was created. #### Error Response (404) - **detail** (str) - "Item not found" if the item with the specified ID does not exist. #### Response Example ```json { "id": 1, "name": "Example Item", "price": 25.50, "description": "Updated description for the item.", "created_at": "2023-10-27T10:00:00" } ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.