Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/http/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python瓶子模块导致;错误:413请求实体太大“;_Python_Http_Runtime Error_Bottle - Fatal编程技术网

Python瓶子模块导致;错误:413请求实体太大“;

Python瓶子模块导致;错误:413请求实体太大“;,python,http,runtime-error,bottle,Python,Http,Runtime Error,Bottle,使用Python的模块bottle,我在发布body size>bottle的内部MEMFILE\u MAX常量请求时遇到HTTP 413错误。下面显示了最小的工作示例 服务器部件(Server.py): 客户端部分(Client.py): 第一个请求打印: 100000 ... <body> <h1>Error: 413 Request Entity Too Large</h1> <p>Sorry, the requested

使用Python的模块
bottle
,我在发布body size>
bottle
的内部
MEMFILE\u MAX
常量请求时遇到HTTP 413错误。下面显示了最小的工作示例

服务器部件(
Server.py
):

客户端部分(
Client.py
):

第一个请求打印:

100000
...
<body>
    <h1>Error: 413 Request Entity Too Large</h1>
    <p>Sorry, the requested URL <tt>&#039;http://127.0.0.1:8008/test&#039;</tt>
       caused an error:</p>
    <pre>Request to large</pre>
</body>
....
第二个请求打印:

100000
...
<body>
    <h1>Error: 413 Request Entity Too Large</h1>
    <p>Sorry, the requested URL <tt>&#039;http://127.0.0.1:8008/test&#039;</tt>
       caused an error:</p>
    <pre>Request to large</pre>
</body>
....
。。。
错误:413请求实体太大
抱歉,请求的URL';http://127.0.0.1:8008/test'
导致错误的原因:

import bottle
bottle.BaseRequest.MEMFILE_MAX = 1024 * 1024 # (or whatever you want)
请求大 ....

我完全不知道如何增加
瓶子的内部限制。是否有任何简单的方法来增加限制,允许大小的请求,例如1MB?

您应该能够


这似乎是基于的唯一方法,请尝试将
瓶子.BaseRequest.MEMFILE_MAX
更改为大于
102400
的值。我喜欢这个数字102400。这太有意义了。@vy32实际上没有它那么武断。谢谢。真有趣<代码>#TODO不应硬编码…
。现在它不再是了!正好解决了我的问题!我怀疑我将不得不以某种方式访问
MEMFILE\u MAX
属性,但我一点也不确定。谢谢另一个堆栈溢出用户保存了我的一天:)只是为了方便:值以字节为单位,标准大小是102400(正如您链接中的来源也提到的)您,先生,我的一天