我收到错误:
<?php
$url = "https://www.example.com/r/videos/.xml";
$feed_dom = new domDocument;
$feed_dom->load($url);
$feed_dom->preserveWhiteSpace = false;
$items = $feed_dom->getElementsByTagName('item');
foreach($items as $item){
$title = $item->getElementsByTagName('title')->item(0)->nodeValue;
$desc_table = $item->getElementsByTagName('description')->item(0)->nodeValue;
echo $title . "<br>";
$table_dom = new domDocument;
$table_dom->loadHTML($desc_table);
$xpath = new DOMXpath($table_dom);
$table_dom->preserveWhiteSpace = false;
$yt_link_node = $xpath->query("//table/tr/td[2]/a[2]");
foreach($yt_link_node as $yt_link){
$yt = $yt_link->getAttribute('href');
echo $yt . "<br>";
echo "<br>";
}
}
?>
代码如下:
The request to API call datastore_v3.Put() was too large.
File "/base/data/home/apps/s~app-prod/version/controllers/app/file.py", line 470, in function_name
temp_o.put()
RequestTooLargeError: The request to API call datastore_v3.Put() was too large.
当我使用以下代码获得temp_o.list的大小时:
temp_o = models.Temp.all().get()
temp_o.list = json.dumps(temp_list)
temp_o.put()
我得到的结果是:
logging.info('size of list = %s', sys.getsizeof(temp_o.list))
由于sys.getsizeof()以字节为单位返回值,因此这仅为4.2 MB。为什么只保存4.2 MB的数据会导致Google App Engine中的RequestTooLargeError?
答案 0 :(得分:3)
这是由于最大实体大小限制为1MB。在我的例子中,temp_o.list是一个TextProperty。请参阅cloud.google.com/appengine/docs/python/datastore(滚动到页面底部)