自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

人生苦短,我用Python!

Life is short, you need Python!

  • 博客(43)
  • 问答 (2)
  • 收藏
  • 关注

翻译 FastAPI 教程翻译 - 用户指南 35 - 调试

FastAPI 教程翻译 - 用户指南 35 - 调试FastAPI Tutorial - User Guide - DebuggingYou can connect the debugger in your editor, for example with Visual Studio Code or PyCharm.您可以在编辑器中连接调试器,例如使用 Visual Studio Code 或 PyCharm。Call uvicorn调用 uvicornIn your FastAPI appl

2020-06-08 22:31:02 2252 1

翻译 FastAPI 教程翻译 - 用户指南 34 - 测试

FastAPI 教程翻译 - 用户指南 34 - 测试FastAPI Tutorial - User Guide - TestingThanks to Starlette, testing FastAPI applications is easy and enjoyable.多亏了 Starlette,测试 FastAPI 应用程序变得轻松而愉快。It is based on Requests, so it’s very familiar and intuitive.它基于 Requests,因此

2020-06-08 22:30:06 694 1

翻译 FastAPI 教程翻译 - 用户指南 33 - 静态文件

FastAPI 教程翻译 - 用户指南 33 - 静态文件FastAPI Tutorial - User Guide - Static FilesYou can serve static files automatically from a directory using StaticFiles.您可以使用 StaticFiles 从目录自动提供静态文件。Install aiofiles安装 aiofilesFirst you need to install aiofiles:首先,您需要安装

2020-06-08 22:29:28 1124 1

翻译 FastAPI 教程翻译 - 用户指南 32 - 元数据和文档网址

FastAPI 教程翻译 - 用户指南 32 - 元数据和文档网址FastAPI Tutorial - User Guide - Metadata and Docs URLsThere are several things that you can configure in your FastAPI application.您可以在 FastAPI 应用程序中配置几件事。Title, description, and version标题、描述和版本You can set the:您可以设置:

2020-06-08 22:26:58 353

翻译 FastAPI 教程翻译 - 用户指南 31 - 后台任务

FastAPI 教程翻译 - 用户指南 31 - 后台任务FastAPI Tutorial - User Guide - Background TasksYou can define background tasks to be run after returning a response.您可以定义要在返回响应后运行的后台任务。This is useful for operations that need to happen after a request, but that the client

2020-06-08 22:24:34 1345

翻译 FastAPI 教程翻译 - 用户指南 30 - 更大的应用程序 - 多个文件

FastAPI 教程翻译 - 用户指南 30 - 更大的应用程序 - 多个文件FastAPI Tutorial - User Guide - Bigger Applications - Multiple FilesIf you are building an application or a web API, it’s rarely the case that you can put everything on a single file.如果要构建应用程序或 Web API,则很少将所有内容都放在一

2020-06-07 22:48:59 678 1

翻译 FastAPI 教程翻译 - 用户指南 29 - SQL(关系)数据库

FastAPI 教程翻译 - 用户指南 29 - SQL(关系)数据库FastAPI Tutorial - User Guide - SQL (Relational) DatabasesFastAPI doesn’t require you to use a SQL (relational) database.FastAPI 不需要您使用 SQL(关系)数据库。But you can use any relational database that you want.但是您可以使用所需的任何关系数

2020-06-07 22:48:02 2536 3

翻译 FastAPI 教程翻译 - Python 类型介绍

FastAPI 教程翻译 - Python 类型介绍Python Types IntroPython 3.6+ has support for optional “type hints”.Python 3.6+ 支持可选的『类型提示』。These “type hints” are a new syntax (since Python 3.6+) that allow declaring the type of a variable.这些**『类型提示』**是一种新语法(自 Python 3.6+

2020-05-30 11:34:17 566 2

翻译 FastAPI 教程翻译 - 特征

FastAPI 教程翻译 - 特征FastAPI FeaturesFastAPI gives you the following:FastAPI 为您提供以下内容:Based on open standards基于开放标准OpenAPI for API creation, including declarations of path operations, parameters, body requests, security, etc.用于 API 创建的 OpenAPI,包括声明路径操

2020-05-30 11:32:18 688

翻译 FastAPI 教程翻译 - 介绍

FastAPI 教程翻译 - 介绍FastAPI framework, high performance, easy to learn, fast to code, ready for productionFastAPI 框架,高性能,易于学习,快速编写代码,可投入生产Documentation: https://fastapi.tiangolo.com文档:https://fastapi.tiangolo.comSource Code: https://github.com/tiangolo

2020-05-30 11:29:34 2676 1

翻译 FastAPI 教程翻译 - 用户指南 28 - CORS(跨域资源共享)

FastAPI 教程翻译 - 用户指南 28 - CORS(跨域资源共享)FastAPI Tutorial - User Guide - CORS (Cross-Origin Resource Sharing)CORS or “Cross-Origin Resource Sharing” refers to the situations when a frontend running in a browser has JavaScript code that communicates with a ba

2020-05-29 16:43:02 1844 3

翻译 FastAPI 教程翻译 - 用户指南 27 - 中间件

FastAPI 教程翻译 - 用户指南 27 - 中间件FastAPI Tutorial - User Guide - MiddlewareYou can add middleware to FastAPI applications.您可以将中间件添加到 FastAPI 应用程序中。A “middleware” is a function that works with every request before it is processed by any specific path operati

2020-05-29 11:08:10 859

翻译 FastAPI 教程翻译 - 用户指南 26 - 安全性

FastAPI 教程翻译 - 用户指南 26 - 安全性FastAPI Tutorial - User Guide - SecuitySecurity Intro安全性简介There are many ways to handle security, authentication and authorization.有许多方法可以处理安全性、身份验证和授权。And it normally is a complex and “difficult” topic.这通常是一个复杂而『困难』的话题。

2020-05-28 09:26:17 1769

翻译 FastAPI 教程翻译 - 用户指南 25 - 依赖项

FastAPI 教程翻译 - 用户指南 25 - 依赖项FastAPI Tutorial - User Guide - DependenciesFirst Steps第一步FastAPI has a very powerful but intuitive Dependency Injection system.FastAPI 具有非常强大而且直观的依赖注入系统。It is designed to be very simple to use, and to make it very easy fo

2020-05-28 09:25:28 1823

翻译 FastAPI 教程翻译 - 用户指南 24 - 主体 - 更新

FastAPI 教程翻译 - 用户指南 24 - 主体 - 更新FastAPI Tutorial - User Guide - Body - updatesUpdate replacing with PUT更新为 PUTTo update an item you can use the HTTP PUT operation.要更新项目,您可以使用 HTTP PUT 操作。You can use the jsonable_encoder to convert the input data to d

2020-05-28 09:24:07 578

翻译 FastAPI 教程翻译 - 用户指南 23 - JSON 兼容编码器

FastAPI 教程翻译 - 用户指南 23 - JSON 兼容编码器FastAPI Tutorial - User Guide - JSON Compatible EncoderThere are some cases where you might need to convert a data type (like a Pydantic model) to something compatible with JSON (like a dict, list, etc).在某些情况下,您可能需要将数据

2020-05-28 09:23:15 325

翻译 FastAPI 教程翻译 - 用户指南 22 - 路径操作配置

FastAPI 教程翻译 - 用户指南 22 - 路径操作配置FastAPI Tutorial - User Guide - Path Operation ConfigurationThere are several parameters that you can pass to your path operation decorator to configure it.您可以将几个参数传递给路径操作装饰器进行配置。Warning警告Notice that these parameters a

2020-05-27 15:56:39 413

翻译 FastAPI 教程翻译 - 用户指南 21 - 处理错误

FastAPI 教程翻译 - 用户指南 21 - 处理错误FastAPI Tutorial - User Guide - Handling ErrorsThere are many situations in where you need to notify an error to a client that is using your API.在许多情况下,您需要将错误通知给使用 API 的客户端。This client could be a browser with a frontend, a

2020-05-27 15:54:53 3681

翻译 FastAPI 教程翻译 - 用户指南 20 - 请求表单和文件

FastAPI 教程翻译 - 用户指南 20 - 请求表单和文件FastAPI Tutorial - User Guide - Request Forms and FilesYou can define files and form fields at the same time using File and Form.您可以使用 File 和 Form 同时定义文件和表单字段Info信息To receive uploaded files and/or form data, first ins

2020-05-27 15:54:13 415

翻译 FastAPI 教程翻译 - 用户指南 19 请求文件

FastAPI 教程翻译 - 用户指南 19 请求文件FastAPI Tutorial - User Guide - Request FilesYou can define files to be uploaded by the client using File.您可以使用 File 定义客户端上传的文件。Info信息To receive uploaded files, first install python-multipart.要接收上传的文件,请先安装 python-multipar

2020-05-27 15:27:56 408

翻译 FastAPI 教程翻译 - 用户指南 18 - 表单数据

FastAPI 教程翻译 - 用户指南 18 - 表单数据FastAPI Tutorial - User Guide - Form DataWhen you need to receive form fields instead of JSON, you can use Form.当您需要接收表单字段而不是 JSON 时,可以使用 Form。Info信息To use forms, first install python-multipart.要使用表单,请先安装 python-multipa

2020-05-27 15:26:51 619 1

翻译 FastAPI 教程翻译 - 用户指南 17 - 响应状态码

FastAPI 教程翻译 - 用户指南 17 - 响应状态码FastAPI Tutorial - User Guide - Response Status CodeThe same way you can specify a response model, you can also declare the HTTP status code used for the response with the parameter status_code in any of the path operations:

2020-05-27 15:26:05 592

翻译 FastAPI 教程翻译 - 用户指南 16 - 额外模型

FastAPI 教程翻译 - 用户指南 16 - 额外模型FastAPI Tutorial - User Guide - Extra ModelsContinuing with the previous example, it will be common to have more than one related model.继续前面的示例,通常会有多个相关模型。This is especially the case for user models, because:用户模型尤其如此,因为:

2020-05-27 15:22:06 384

翻译 FastAPI 教程翻译 - 用户指南 15 - 响应模型

FastAPI 教程翻译 - 用户指南 15 - 响应模型FastAPI Tutorial - User Guide - Response ModelYou can declare the model used for the response with the parameter response_model in any of the path operations:您可以在任何路径操作中使用参数 response_model 声明用于响应的模型:@app.get()@app.post

2020-05-27 15:19:25 589

翻译 FastAPI 教程翻译 - 用户指南 14 - Header 参数

FastAPI 教程翻译 - 用户指南 14 - Header 参数FastAPI Tutorial - User Guide - Header ParametersYou can define Header parameters the same way you define Query, Path and Cookie parameters.您可以使用定义 Query、Path、Cookie 参数的方法来定义 Header 参数。Import Header导入 HeaderFirst imp

2020-05-27 15:17:34 672

翻译 FastAPI 教程翻译 - 用户指南 13 - Cookie 参数

FastAPI 教程翻译 - 用户指南 13 - Cookie 参数FastAPI Tutorial - User Guide - Cookie ParametersYou can define Cookie parameters the same way you define Query and Path parameters.您可以使用定义 Query 和 Path 参数的相同方式来定义 Cookie 参数。Import Cookie导入 CookieFirst import Cookie:

2020-05-27 15:16:46 357

翻译 FastAPI 教程翻译 - 用户指南 12 - 额外的数据类型

FastAPI 教程翻译 - 用户指南 12 - 额外的数据类型FastAPI Tutorial - User Guide - Extra data typesUp to now, you have been using common data types, like:到目前为止,您一直在使用常见的数据类型,例如:intfloatstrboolBut you can also use more complex data types.但是您也可以使用更复杂的数据类型。And you w

2020-05-27 15:15:21 209

翻译 FastAPI 教程翻译 - 用户指南 11 - 模式扩展 - 示例

FastAPI 教程翻译 - 用户指南 11 - 模式扩展 - 示例FastAPI Tutorial - User Guide - Schema Extra - ExampleYou can define extra information to go in JSON Schema.您可以定义其他信息以放入 JSON 模式。A common use case is to add an example that will be shown in the docs.一个常见的用例是添加一个将在文档中显

2020-05-27 14:59:53 458

翻译 FastAPI 教程翻译 - 用户指南 10 - 请求主体 - 嵌套模型

FastAPI 教程翻译 - 用户指南 10 - 请求主体 - 嵌套模型FastAPI Tutorial - User Guide - Body - Nested ModelsWith FastAPI, you can define, validate, document, and use arbitrarily deeply nested models (thanks to Pydantic).使用 FastAPI,您可以定义、验证、文档和使用任意深度嵌套的模型(感谢 Pydantic)。List

2020-05-27 14:09:45 773

翻译 FastAPI 教程翻译 - 用户指南 9 - 请求主体 - 字段

FastAPI 教程翻译 - 用户指南 9 - 请求主体 - 字段FastAPI Tutorial - User Guide - Body - FieldsThe same way you can declare additional validation and metadata in path operation function parameters with Query, Path and Body, you can declare validation and metadata inside

2020-05-27 14:08:48 462

翻译 FastAPI 教程翻译 - 用户指南 8 - 请求主体 - 多个参数

FastAPI 教程翻译 - 用户指南 8 - 请求主体 - 多个参数FastAPI Tutorial - User Guide - Body - Multiple ParametersNow that we have seen how to use Path and Query, let’s see more advanced uses of request body declarations.既然我们已经了解了如何使用 Path 和 Query,那么让我们来看一下请求主体声明的更高级用法。Mix

2020-05-27 14:07:55 440

翻译 FastAPI 教程翻译 - 用户指南 7 - 路径参数和数值验证

FastAPI 教程翻译 - 用户指南 7 - 路径参数和数值验证FastAPI Tutorial - User Guide - Path Parameters and Numeric ValidationsThe same way you can declare more validations and metadata for query parameters with Query, you can declare the same type of validations and metadata

2020-05-27 14:07:06 413

翻译 FastAPI 教程翻译 - 用户指南 6 - 查询参数和字符串验证

FastAPI 教程翻译 - 用户指南 6 - 查询参数和字符串验证FastAPI Tutorial - User Guide - Query Parameters and String ValidationsFastAPI allows you to declare additional information and validation for your parameters.FastAPI 允许您声明其他信息并验证参数。Let’s take this application as examp

2020-05-27 14:05:47 451

原创 指令字长与操作数

某计算机指令字长为16位,指令有双操作数、单操作数和无操作数3种格式,每个操作数字段均用6位二进制表示,该指令系统共有M条(M  固定码:指令占固定位数。   扩展码:根据操作数的情况采用几种不同位数的指令编码。 既占用操作数位来增加指令位长实现指令的增多。  本题用扩展码编码方式,双操作数指令最多占(16-6*2)即4位,如不用扩展编

2020-05-27 14:03:43 9300 1

翻译 FastAPI 教程翻译 - 用户指南 5 - 请求主体

When you need to send data from a client (let’s say, a browser) to your API, you send it as a request body.当您需要将数据从客户端(例如浏览器)发送到 API 时,可以将其作为请求主体发送。A request body is data sent by the client to your API. A response body is the data your API sends to the c

2020-05-19 17:02:24 777 1

翻译 FastAPI 教程翻译 - 用户指南 4 - 查询参数

When you declare other function parameters that are not part of the path parameters, they are automatically interpreted as “query” parameters.声明不属于路径参数的其他视图函数参数时,它们将自动解释为『查询』参数。from fastapi import FastAPIapp = FastAPI()fake_items_db = [{"item_name":

2020-05-19 17:00:12 583

翻译 FastAPI 教程翻译 - 用户指南 3 - 路径参数

You can declare path “parameters” or “variables” with the same syntax used by Python format strings:您可以使用 Python 格式字符串使用的相同语法声明路径『参数』或『变量』:from fastapi import FastAPIapp = FastAPI()@app.get("/items/{item_id}")async def read_item(item_id): retur

2020-05-19 16:55:53 2413

翻译 FastAPI 教程翻译 - 用户指南 2 - 第一步

The simplest FastAPI file could look like this:最简单的 FastAPI 文件可能如下所示:from fastapi import FastAPIapp = FastAPI()@app.get("/")async def root(): return {"message": "Hello World"}Copy that to a file main.py.将其复制到文件 main.py 中。Run the live server

2020-05-19 16:33:17 965

翻译 FastAPI 教程翻译 - 用户指南 1 - 简介

FastAPI 教程翻译 - 用户指南 1 - 简介 Tutorial - User Guide - IntroThis tutorial shows you how to use FastAPI with most of its features, step by step.本教程将逐步向您展示如何使用 FastAPI 及其大部分功能。Each section gradually builds on the previous ones, but it’s structured to separate

2020-05-19 16:28:39 515

原创 冲击波

“冲击波”病毒属于蠕虫类型的病毒,它利用WINDOWS操作系统的RPC漏洞进行快速传播。蠕虫,没有宿主文件. RPC,远程过程调用 

2007-10-03 18:09:00 782

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除