{"id":204940,"date":"2025-05-29T13:36:49","date_gmt":"2025-05-29T05:36:49","guid":{"rendered":"https:\/\/server.hk\/cnblog\/204940\/"},"modified":"2025-05-29T13:36:49","modified_gmt":"2025-05-29T05:36:49","slug":"%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8-python-%e5%92%8c-fastapi-%e5%a4%84%e7%90%86%e6%96%87%e4%bb%b6%e4%b8%8a%e4%bc%a0","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/204940\/","title":{"rendered":"\u5982\u4f55\u4f7f\u7528 Python \u548c FastAPI \u5904\u7406\u6587\u4ef6\u4e0a\u4f20"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>\u5982\u4f55\u4f7f\u7528 Python \u548c FastAPI \u5904\u7406\u6587\u4ef6\u4e0a\u4f20<\/h1>\n<p>\u5c0f\u4f19\u4f34\u4eec\u5bf9\u6587\u7ae0\u7f16\u7a0b\u611f\u5174\u8da3\u5417\uff1f\u662f\u5426\u6b63\u5728\u5b66\u4e60\u76f8\u5173\u77e5\u8bc6\u70b9\uff1f\u5982\u679c\u662f\uff0c\u90a3\u4e48\u672c\u6587\u300a\u5982\u4f55\u4f7f\u7528 Python \u548c FastAPI \u5904\u7406\u6587\u4ef6\u4e0a\u4f20\u300b\uff0c\u5c31\u5f88\u9002\u5408\u4f60\uff0c\u672c\u7bc7\u6587\u7ae0\u8bb2\u89e3\u7684\u77e5\u8bc6\u70b9\u4e3b\u8981\u5305\u62ec\u3002\u5728\u4e4b\u540e\u7684\u6587\u7ae0\u4e2d\u4e5f\u4f1a\u591a\u591a\u5206\u4eab\u76f8\u5173\u77e5\u8bc6\u70b9\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u7684\u77e5\u8bc6\u79ef\u7d2f\u6709\u6240\u5e2e\u52a9\uff01<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241119\/1732022510673c90ee1a564.jpg\" class=\"aligncenter\"><\/p>\n<p>\u5b89\u5168\u5730\u5904\u7406\u6587\u4ef6\u4e0a\u4f20\u662f\u73b0\u4ee3\u5e94\u7528\u7a0b\u5e8f\u7684\u5e38\u89c1\u9700\u6c42\uff0c\u4f46\u5b83\u4e5f\u9762\u4e34\u7740\u6311\u6218\u3002\u4ece\u7ba1\u7406\u5927\u578b\u6587\u4ef6\u5230\u786e\u4fdd\u5185\u5bb9\u4e0d\u662f\u6076\u610f\u7684\uff0c\u5f00\u53d1\u4eba\u5458\u5fc5\u987b\u5b9e\u65bd\u5f3a\u5927\u7684\u89e3\u51b3\u65b9\u6848\u3002\u5728\u672c\u6307\u5357\u4e2d\uff0c\u6211\u4eec\u5c06\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528 python \u7684 fastapi \u6765\u5904\u7406\u6587\u4ef6\u4e0a\u4f20\u3002\u53e6\u5916\uff0c\u6211\u4eec\u5c06\u5411\u60a8\u5c55\u793a\u5982\u4f55\u96c6\u6210 verisys antivirus api \u6765\u626b\u63cf\u6587\u4ef6\u4e2d\u662f\u5426\u5b58\u5728\u6076\u610f\u8f6f\u4ef6\uff0c\u4ece\u800c\u4fdd\u62a4\u60a8\u7684\u5e94\u7528\u7a0b\u5e8f\u548c\u7528\u6237\u3002<\/p>\n<blockquote>\n<p><strong>\u6ce8\u610f<\/strong>\uff1a\u8981\u9075\u5faa\u672c\u6559\u7a0b\uff0c\u60a8\u5c06\u9700\u8981\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<ul>\n<li> \u60a8\u7684\u673a\u5668\u4e0a\u5b89\u88c5\u4e86 python 3.7+<\/li>\n<li>python\u548cfastapi\u57fa\u7840\u77e5\u8bc6 <\/li>\n<li>\u6587\u672c\u7f16\u8f91\u5668\u6216\u8f7b\u91cf\u7ea7 ide\uff0c\u4f8b\u5982 visual studio code <\/li>\n<\/ul>\n<\/blockquote>\n<p>fastapi \u662f\u4e00\u4e2a\u73b0\u4ee3\u7684 python web \u6846\u67b6\uff0c\u4f7f\u60a8\u80fd\u591f\u5feb\u901f\u6784\u5efa api\u3002\u5b83\u57fa\u4e8e\u6807\u51c6 python \u7c7b\u578b\u63d0\u793a\u6784\u5efa\uff0c\u4f7f\u5176\u66f4\u6613\u4e8e\u4f7f\u7528\u548c\u7ef4\u62a4\u3002\u51ed\u501f\u5bf9\u5f02\u6b65\u8bf7\u6c42\u5904\u7406\u7684\u5185\u7f6e\u652f\u6301\uff0c\u5b83\u4e5f\u662f\u9ad8\u6027\u80fd\u5e94\u7528\u7a0b\u5e8f\u7684\u7406\u60f3\u9009\u62e9\u3002<\/p>\n<p>\u4e0e verisys antivirus api \u76f8\u7ed3\u5408\uff0cfastapi \u53ef\u5e2e\u52a9\u60a8\u6784\u5efa\u5b89\u5168\u7684\u6587\u4ef6\u4e0a\u4f20\u7aef\u70b9\uff0c\u8fd9\u5bf9\u4e8e\u5904\u7406\u6f5c\u5728\u4e0d\u5b89\u5168\u6587\u4ef6\u7684\u4efb\u4f55 web \u6216\u79fb\u52a8\u5e94\u7528\u7a0b\u5e8f\u81f3\u5173\u91cd\u8981\u3002<\/p>\n<p>\u7b2c\u4e00\u6b65\u662f\u521b\u5efa\u4e00\u4e2a python \u73af\u5883\uff0c\u51c6\u5907\u597d\u6211\u4eec\u5c06\u7528\u4e8e fastapi \u9879\u76ee\u7684\u5e93\u3002<\/p>\n<ol>\n<li>\n<p>\u6253\u5f00\u7ec8\u7aef\u6216\u547d\u4ee4\u63d0\u793a\u7b26\uff0c\u7136\u540e\u5bfc\u822a\u5230\u8981\u5b58\u50a8\u9879\u76ee\u7684\u76ee\u5f55<\/p>\n<\/li>\n<li>\n<p>\u521b\u5efa\u5e76\u6fc0\u6d3b\u865a\u62df\u73af\u5883<\/p>\n<\/li>\n<li>\n<p>\u5b89\u88c5 fastapi\u3001uvicorn \u548c python-multipart\uff1a<\/p>\n<pre>pip install fastapi uvicorn python-multipart\n<\/pre>\n<\/li>\n<li>\n<p>\u5728\u672c\u6559\u7a0b\u4e2d\uff0c\u6211\u4eec\u8fd8\u5c06\u4f7f\u7528\u8bf7\u6c42\u5e93\u5c06\u4e0a\u4f20\u7684\u6587\u4ef6\u53d1\u9001\u5230 verisys antivirus api \u8fdb\u884c\u6076\u610f\u8f6f\u4ef6\u626b\u63cf\uff1a<\/p>\n<pre>pip install requests\n<\/pre>\n<\/li>\n<\/ol>\n<p>\u8ba9\u6211\u4eec\u9996\u5148\u8bbe\u7f6e\u4e00\u4e2a\u63a5\u53d7\u6587\u4ef6\u4e0a\u4f20\u7684\u7b80\u5355 fastapi \u5e94\u7528\u7a0b\u5e8f\u3002\u521b\u5efa\u4e00\u4e2a\u5305\u542b\u4ee5\u4e0b\u5185\u5bb9\u7684\u6587\u4ef6 main.py\uff1a<\/p>\n<pre>from fastapi import fastapi, file, uploadfile\nimport uvicorn\nimport logging\n\nlogger = logging.getlogger('uvicorn.error')\nlogger.setlevel(logging.debug)\n\napp = fastapi()\n\n@app.post(\"\/upload\/\")\nasync def upload_file(file: uploadfile = file(...)):\n    content = await file.read()\n\n    # print information about the file to the console\n    logger.debug(f\"file name: {file.filename}\")\n    logger.debug(f\"file size: {len(content)}\")\n    logger.debug(f\"file mime type: {file.content_type}\")\n\n    # return information about the file to the caller - note that the\n    # content_type can easily be spoofed\n    return {\"filename\": file.filename, \"file_size\": len(content), \"file_mime_type\": file.content_type}\n\nif __name__ == \"__main__\":\n    uvicorn.run(app, host=\"0.0.0.0\", port=8000)\n<\/pre>\n<p>\u8981\u4f7f\u7528 uvicorn web \u670d\u52a1\u5668\u8fd0\u884c api\uff0c\u8bf7\u4ece\u4e0e main.py \u76f8\u540c\u7684\u6587\u4ef6\u5939\u4e2d\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>uvicorn main:app --reload\n<\/pre>\n<p>&#8211;reload \u6807\u5fd7\u5141\u8bb8\u670d\u52a1\u5668\u5728\u6211\u4eec\u66f4\u6539\u4ee3\u7801\u65f6\u81ea\u52a8\u91cd\u65b0\u52a0\u8f7d\uff0c\u8fd9\u5728\u5f00\u53d1\u8fc7\u7a0b\u4e2d\u5f88\u6709\u5e2e\u52a9\u3002<\/p>\n<p>uvicorn \u542f\u52a8\u540e\uff0c\u60a8\u5c06\u770b\u5230\u6307\u793a\u5e94\u7528\u7a0b\u5e8f\u6b63\u5728\u8fd0\u884c\u7684\u8f93\u51fa\uff0c\u4ee5\u53ca\u53ef\u8bbf\u95ee\u8be5\u5e94\u7528\u7a0b\u5e8f\u7684 url\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5b83\u5c06\u8fd0\u884c\u5728\uff1a<\/p>\n<pre>http:\/\/127.0.0.1:8000\n<\/pre>\n<p>\u8981\u6d4b\u8bd5\u57fa\u672c\u7684\u6587\u4ef6\u4e0a\u4f20\u529f\u80fd\uff0c\u60a8\u53ef\u4ee5\u7b80\u5355\u5730\u4f7f\u7528curl\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528postman\u6216insomnia\u7b49\u5de5\u5177\u3002<\/p>\n<p>\u8fd9\u662f\u4e00\u4e2a\u4f7f\u7528curl\u7684\u793a\u4f8b\uff0c\u5176\u4e2d\u5305\u542b\u6587\u4ef6testfile.png\uff08\u66ff\u6362\u60a8\u8981\u4e0a\u4f20\u7684\u4efb\u4f55\u6587\u4ef6\uff09\uff1a<\/p>\n<pre>curl -f \"file=@testfile.png\" http:\/\/127.0.0.1:8000\/upload\/\n<\/pre>\n<p>\u60a8\u5e94\u8be5\u770b\u5230\u7c7b\u4f3c\u4e8e\u4ee5\u4e0b\u5185\u5bb9\u7684\u7ed3\u679c\uff1a<\/p>\n<pre>{\n  \"filename\":\"testfile.png\",\n  \"file_size\":26728,\n  \"file_mime_type\":\"image\/png\"\n}\n<\/pre>\n<p>\u4e0a\u4f20\u6587\u4ef6\u53ea\u662f\u4e00\u4e2a\u5f00\u59cb\uff0c\u4f46\u786e\u4fdd\u4e0a\u4f20\u7684\u6587\u4ef6\u4e0d\u542b\u6076\u610f\u8f6f\u4ef6\u81f3\u5173\u91cd\u8981\uff0c\u5c24\u5176\u662f\u5728\u63a5\u53d7\u6765\u81ea\u6700\u7ec8\u7528\u6237\u7684\u6587\u4ef6\u65f6\u3002 verisys antivirus api \u5141\u8bb8\u6211\u4eec\u5728\u8fdb\u4e00\u6b65\u5904\u7406\u6587\u4ef6\u4e4b\u524d\u626b\u63cf\u6587\u4ef6\u3002<\/p>\n<blockquote>\n<p><em>verisys antivirus api \u662f\u4e00\u79cd\u4e0e\u8bed\u8a00\u65e0\u5173\u7684 rest api\uff0c\u53ef\u8ba9\u60a8\u8f7b\u677e\u5730\u5c06\u6076\u610f\u8f6f\u4ef6\u626b\u63cf\u6dfb\u52a0\u5230\u79fb\u52a8\u5e94\u7528\u7a0b\u5e8f\u3001web \u5e94\u7528\u7a0b\u5e8f\u548c\u540e\u7aef\u5904\u7406\u4e2d\u3002<\/em><\/p>\n<p><em>\u901a\u8fc7\u626b\u63cf\u7528\u6237\u751f\u6210\u7684\u5185\u5bb9\u548c\u6587\u4ef6\u4e0a\u4f20\uff0cverisys antivirus api \u53ef\u4ee5\u5728\u5371\u9669\u6076\u610f\u8f6f\u4ef6\u5230\u8fbe\u60a8\u7684\u670d\u52a1\u5668\u3001\u5e94\u7528\u7a0b\u5e8f\u6216\u6700\u7ec8\u7528\u6237\u4e4b\u524d\u5c06\u5176\u963b\u6b62\u5728\u8fb9\u7f18\u3002<\/em><\/p>\n<\/blockquote>\n<p>\u4ee5\u4e0b\u662f\u5982\u4f55\u96c6\u6210 verisys antivirus api \u6765\u626b\u63cf\u4e0a\u4f20\u7684\u6587\u4ef6\uff1a<\/p>\n<ol>\n<li>\n<p><strong>\u83b7\u53d6\u60a8\u7684 verisys api \u5bc6\u94a5<\/strong>\uff1a\u5728\u6211\u4eec\u5f00\u59cb\u4e4b\u524d\uff0c\u8bf7\u786e\u4fdd\u60a8\u62e5\u6709 verisys antivirus api \u5bc6\u94a5\u3002\u5982\u679c\u60a8\u6ca1\u6709\uff0c\u8bf7\u8bbf\u95ee verisys antivirus api \u5f00\u59cb\u4f7f\u7528\u6216\u7533\u8bf7\u8bd5\u7528\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u5c06\u6587\u4ef6\u53d1\u9001\u5230 verisys antivirus api<\/strong>\uff1a\u6536\u5230\u6587\u4ef6\u540e\uff0c\u5c06\u5176\u53d1\u9001\u5230 verisys api \u8fdb\u884c\u626b\u63cf\u3002<\/p>\n<\/li>\n<\/ol>\n<p>\u4f7f\u7528\u4ee5\u4e0b\u5185\u5bb9\u66f4\u65b0 main.py\uff1a<\/p>\n<pre>from fastapi import fastapi, file, uploadfile\nimport uvicorn\nimport requests\nimport logging\n\nverisys_api_url = \"https:\/\/eu1.api.av.ionxsolutions.com\/v1\/malware\/scan\/file\"\napi_key = \"your_api_key\"\n\nlogger = logging.getlogger('uvicorn.error')\nlogger.setlevel(logging.debug)\n\napp = fastapi()\n\nclass scanresult:\n    def __init__(self, filename=\"\", status=\"\", content_type=\"\", signals=none, metadata=none):\n        self.filename = filename\n        self.status = status\n        self.content_type = content_type\n        self.signals = signals if signals is not none else []\n        self.metadata = metadata if metadata is not none else []\n\n    def __repr__(self):\n        return f\"scanresult(filename={self.filename},status={self.status}, content_type={self.content_type}, signals={self.signals}, metadata={self.metadata})\"\n\ndef scan_file(file_content, filename):\n    files = {'file': (filename, file_content)}\n    headers = {'x-api-key': api_key, 'accept': '*\/*'}\n\n    response = requests.post(verisys_api_url, headers=headers, files=files)\n\n    # was the scan successful?    \n    if response.status_code == 201:\n        result = response.json()\n\n        # print the full scan result to the console\n        logger.debug(f\"scan result: {result}\")\n\n        scan_result = scanresult(\n            filename=filename,\n            status=result[\"status\"],\n            content_type=result[\"content_type\"],\n            signals=result[\"signals\"],\n            metadata=result[\"metadata\"]\n        )\n\n        return scan_result\n    else:\n        return scanresult(status=\"error\", metadata=[{\"message\": \"failed to scan file\"}])\n\n@app.post(\"\/upload\/\")\nasync def upload_file(file: uploadfile = file(...)):\n    content = await file.read()\n\n    # print information about the file to the console\n    logger.debug(f\"file name: {file.filename}\")\n    logger.debug(f\"file size: {len(content)}\")\n    logger.debug(f\"file mime type: {file.content_type}\")\n\n    # scan file with verisys api\n    scan_result = scan_file(content, file.filename)\n\n    # in real-life, you'd now use the scan result to determine what to do \n    # next - but here, we'll just return the scan results to the caller\n\n    return scan_result\n\nif __name__ == \"__main__\":\n    uvicorn.run(app, host=\"0.0.0.0\", port=8000)\n<\/pre>\n<p>\u5728\u6b64\u4fee\u6539\u7248\u672c\u4e2d\uff0c\u6587\u4ef6\u4e0a\u4f20\u540e\uff0c\u4f1a\u4f20\u9012\u5230 scan_file \u51fd\u6570\uff0c\u8be5\u51fd\u6570\u5c06\u6587\u4ef6\u53d1\u9001\u5230 verisys antivirus api \u8fdb\u884c\u626b\u63cf\u3002\u6765\u81ea verisys \u7684\u54cd\u5e94\u4f5c\u4e3a\u7ed3\u679c\u7684\u4e00\u90e8\u5206\u8fd4\u56de\uff0c\u6307\u793a\u8be5\u6587\u4ef6\u662f\u5b89\u5168\u7684\u8fd8\u662f\u6076\u610f\u7684\u3002<\/p>\n<p>\u8981\u6d4b\u8bd5\u6587\u4ef6\u4e0a\u4f20\u548c\u626b\u63cf\u529f\u80fd\uff0c\u4e0e\u4ee5\u524d\u4e00\u6837\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528curl\u6216\u60a8\u559c\u6b22\u7684\u5176\u4ed6\u5de5\u5177\u3002<\/p>\n<p>\u8fd9\u662f\u4e00\u4e2a\u4f7f\u7528curl\u7684\u793a\u4f8b\uff0c\u5e26\u6709eicar\u9632\u75c5\u6bd2\u6d4b\u8bd5\u6587\u4ef6eicar.png\uff08\u66ff\u6362\u60a8\u8981\u4e0a\u4f20\u7684\u4efb\u4f55\u6587\u4ef6\uff09\uff1a<\/p>\n<pre>curl -f \"file=@eicar.png\" http:\/\/127.0.0.1:8000\/upload\/\n<\/pre>\n<p>\u6839\u636e\u60a8\u4e0a\u4f20\u7684\u6587\u4ef6\uff0c\u60a8\u5e94\u8be5\u4f1a\u770b\u5230\u6076\u610f\u8f6f\u4ef6\u626b\u63cf\u7ed3\u679c\uff1a<\/p>\n<pre>{\n  \"filename\": \"eicar.png\",\n  \"status\": \"threat\",\n  \"content_type\": \"text\/plain\",\n  \"signals\": [\n    \"Virus:EICAR_Test_File\"\n  ],\n  \"metadata\": {\n    \"hash_sha1\": \"3395856ce81f2b7382dee72602f798b642f14140\",\n    \"hash_sha256\": \"275a021bbfb6489e54d471899f7db9d1663fc695ec2fe2a2c4538aabf651fd0f\"\n  }\n}\n<\/pre>\n<p>\u60a8\u7684\u4e0a\u4f20\u7aef\u70b9\u53ef\u4ee5\u4f7f\u7528\u626b\u63cf\u7ed3\u679c\u6765\u786e\u5b9a\u4e0b\u4e00\u6b65\u8981\u505a\u4ec0\u4e48 &#8211; \u4f8b\u5982\uff0c\u9632\u6b62\u4e0a\u4f20\u5305\u542b\u6076\u610f\u8f6f\u4ef6\u7684\u6587\u4ef6\u3002<\/p>\n<p>\u8bf7\u6ce8\u610f\uff0c\u867d\u7136\u5728\u6b64\u793a\u4f8b\u4e2d\u6587\u4ef6\u4f2a\u88c5\u6210 png \u56fe\u50cf\u6587\u4ef6\uff0c\u4f46 verisys antivirus api \u68c0\u6d4b\u5230\u5b83\u5b9e\u9645\u4e0a\u662f\u7eaf\u6587\u672c\u6587\u4ef6\uff01<\/p>\n<p>\u4ee5\u4e0b\u662f\u4e00\u4e9b\u786e\u4fdd\u60a8\u7684\u6587\u4ef6\u4e0a\u4f20\u7cfb\u7edf\u5b89\u5168\u7684\u989d\u5916\u63d0\u793a\uff1a<\/p>\n<ul>\n<li>\n<p><strong>\u9650\u5236\u6587\u4ef6\u5927\u5c0f<\/strong>\uff1a\u786e\u4fdd\u60a8\u4e0d\u63a5\u53d7\u8fc7\u5927\u7684\u6587\u4ef6\uff0c\u8fd9\u53ef\u80fd\u4f1a\u5bfc\u81f4\u6027\u80fd\u95ee\u9898\u751a\u81f3 dos \u653b\u51fb\u3002 fastapi \u5141\u8bb8\u60a8\u5b9a\u4e49\u81ea\u5b9a\u4e49\u6587\u4ef6\u5927\u5c0f\u9650\u5236\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u9650\u5236\u6587\u4ef6\u7c7b\u578b<\/strong>\uff1a\u4ec5\u63a5\u53d7\u7279\u5b9a\u6587\u4ef6\u7c7b\u578b\uff08\u4f8b\u5982 pdf\u3001\u56fe\u50cf\uff09\uff0c\u4ee5\u9632\u6b62\u4e0a\u4f20\u53ef\u6267\u884c\u6587\u4ef6\u6216\u6076\u610f\u6587\u4ef6\u3002 <\/p>\n<\/li>\n<\/ul>\n<p>{{% \u65c1\u6ce8 %}}<br \/> \u68c0\u67e5\u6587\u4ef6\u6269\u5c55\u540d\u548c\u5185\u5bb9\u7c7b\u578b\u6807\u5934\u662f\u786e\u4fdd\u6587\u4ef6\u4e0a\u4f20\u5b89\u5168\u7684\u57fa\u672c\u6b65\u9aa4\u3002\u7136\u800c\uff0c\u8fd9\u4e24\u8005\u90fd\u5f88\u5bb9\u6613\u88ab\u6b3a\u9a97\u3002<\/p>\n<p>\u901a\u8fc7\u626b\u63cf\u5b9e\u9645\u6587\u4ef6\u5185\u5bb9\uff0cverisys antivirus api \u53ef\u4ee5\u4e3a\u60a8\u8bc6\u522b 50 \u591a\u79cd\u4e0d\u540c\u7684\u6587\u4ef6\u683c\u5f0f\uff0c\u540c\u65f6\u8fd8\u626b\u63cf\u6587\u4ef6\u662f\u5426\u5b58\u5728\u6076\u610f\u8f6f\u4ef6\u3002<br \/> {{% \/\u65c1\u6ce8 %}}<\/p>\n<blockquote>\n<p><em>\u68c0\u67e5\u6587\u4ef6\u6269\u5c55\u540d\u548c content-type \u6807\u5934\u662f\u786e\u4fdd\u6587\u4ef6\u4e0a\u4f20\u5b89\u5168\u7684\u57fa\u672c\u6b65\u9aa4\u3002\u7136\u800c\uff0c\u8fd9\u4e24\u8005\u90fd\u5f88\u5bb9\u6613\u88ab\u6b3a\u9a97\u3002<\/em><\/p>\n<p><em>\u901a\u8fc7\u626b\u63cf\u5b9e\u9645\u6587\u4ef6\u5185\u5bb9\uff0cverisys antivirus api \u53ef\u4ee5\u4e3a\u60a8\u8bc6\u522b 50 \u591a\u79cd\u4e0d\u540c\u7684\u6587\u4ef6\u683c\u5f0f\uff0c\u540c\u65f6\u8fd8\u626b\u63cf\u6587\u4ef6\u662f\u5426\u5b58\u5728\u6076\u610f\u8f6f\u4ef6\u3002<\/em><\/p>\n<\/blockquote>\n<p>verisys antivirus api \u4e13\u95e8\u8bbe\u8ba1\u7528\u4e8e\u786e\u4fdd\u5e94\u7528\u7a0b\u5e8f\u4e2d\u6587\u4ef6\u4e0a\u4f20\u7684\u5b89\u5168\u3002\u8fd9\u5c31\u662f\u4e3a\u4ec0\u4e48\u5b83\u975e\u5e38\u9002\u5408\u60a8\u7684\u9879\u76ee\uff1a<\/p>\n<ul>\n<li> <strong>\u5f3a\u5927\u7684\u6076\u610f\u8f6f\u4ef6\u68c0\u6d4b<\/strong>\uff1averisys \u53ef\u4ee5\u68c0\u6d4b\u5404\u79cd\u5a01\u80c1\uff0c\u786e\u4fdd\u6ca1\u6709\u6076\u610f\u6587\u4ef6\u6f0f\u7f51\u3002<\/li>\n<li> <strong>\u8f7b\u677e\u96c6\u6210<\/strong>\uff1a\u8be5 api \u53ef\u4ee5\u8f7b\u677e\u4e0e\u4efb\u4f55 web \u6846\u67b6\u96c6\u6210\uff0c\u5305\u62ec fastapi\u3002<\/li>\n<li> <strong>\u5185\u5bb9\u7c7b\u578b\u68c0\u6d4b<\/strong>\uff1a\u9664\u4e86\u6076\u610f\u8f6f\u4ef6\u626b\u63cf\u4e4b\u5916\uff0capi \u8fd8\u4f1a\u626b\u63cf\u6587\u4ef6\u5185\u5bb9\u4ee5\u786e\u5b9a<em>\u771f\u5b9e<\/em> \u6587\u4ef6\u7c7b\u578b\u3002<\/li>\n<\/ul>\n<p>\u5904\u7406\u6587\u4ef6\u4e0a\u4f20\u5bf9\u4e8e\u8bb8\u591a\u5e94\u7528\u7a0b\u5e8f\u6765\u8bf4\u81f3\u5173\u91cd\u8981\uff0c\u4f46\u5fc5\u987b\u91c7\u53d6\u63aa\u65bd\u786e\u4fdd\u5b89\u5168\u3002\u901a\u8fc7\u4f7f\u7528 fastapi \u548c verisys antivirus api\uff0c\u60a8\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a\u5b89\u5168\u7684\u6587\u4ef6\u4e0a\u4f20\u7aef\u70b9\uff0c\u5728\u8fdb\u4e00\u6b65\u5904\u7406\u6587\u4ef6\u4e4b\u524d\u626b\u63cf\u6587\u4ef6\u662f\u5426\u5b58\u5728\u6076\u610f\u8f6f\u4ef6\u3002\u65e0\u8bba\u60a8\u662f\u6784\u5efa web \u5e94\u7528\u7a0b\u5e8f\u8fd8\u662f\u7528\u4e8e\u6587\u4ef6\u5b58\u50a8\u7684 api\uff0c\u6b64\u65b9\u6cd5\u90fd\u53ef\u4ee5\u786e\u4fdd\u60a8\u7684\u57fa\u7840\u67b6\u6784\u548c\u7528\u6237\u514d\u53d7\u6709\u5bb3\u6587\u4ef6\u7684\u4fb5\u5bb3\u3002<\/p>\n<p>\u5982\u679c\u60a8\u8fd8\u6ca1\u6709\uff0c\u8bf7\u7acb\u5373\u6ce8\u518c verisys antivirus api \u5e76\u5f00\u59cb\u4fdd\u62a4\u60a8\u7684\u5e94\u7528\u7a0b\u5e8f\u514d\u53d7\u6076\u610f\u8f6f\u4ef6\u7684\u4fb5\u5bb3\uff01<\/p>\n<p>\u672c\u6559\u7a0b\u7684\u4ee3\u7801\u53ef\u4ee5\u5728 github \u4e0a\u627e\u5230\uff1ahttps:\/\/github.com\/ionxsolutions\/tutorial-file-uploads-fastapi<\/p>\n<p>\u7406\u8bba\u8981\u638c\u63e1\uff0c\u5b9e\u64cd\u4e0d\u80fd\u843d\uff01\u4ee5\u4e0a\u5173\u4e8e\u300a\u5982\u4f55\u4f7f\u7528 Python \u548c FastAPI \u5904\u7406\u6587\u4ef6\u4e0a\u4f20\u300b\u7684\u8be6\u7ec6\u4ecb\u7ecd\uff0c\u5927\u5bb6\u90fd\u638c\u63e1\u4e86\u5427\uff01\u5982\u679c\u60f3\u8981\u7ee7\u7eed\u63d0\u5347\u81ea\u5df1\u7684\u80fd\u529b\uff0c\u90a3\u4e48\u5c31\u6765\u5173\u6ce8\u516c\u4f17\u53f7\u5427\uff01<\/p>\n<p>      \u7248\u672c\u58f0\u660e \u672c\u6587\u8f6c\u8f7d\u4e8e\uff1adev.to \u5982\u6709\u4fb5\u72af\uff0c\u8bf7\u8054\u7cfb\u5220\u9664<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u4f7f\u7528 Python \u548c Fa&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4925],"tags":[],"class_list":["post-204940","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/204940","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=204940"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/204940\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=204940"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=204940"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=204940"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}