Skip to content

Commit

Permalink
支持指定渲染时间
Browse files Browse the repository at this point in the history
  • Loading branch information
Boris committed Apr 11, 2021
1 parent f617366 commit 544c27c
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 31 deletions.
31 changes: 1 addition & 30 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,36 +89,7 @@
}
</script>

<!-- 百度分享 -->
<script>
window._bd_share_config = {
"common": {
"bdSnsKey": {},
"bdText": "",
"bdMini": "2",
"bdMiniList": false,
"bdPic": "",
"bdStyle": "1",
"bdSize": "24"
},
"slide": {
"type": "slide",
"bdImg": "1",
"bdPos": "right",
"bdTop": "151.5"
},
"image": {
"viewList": ["weixin", "qzone", "tsina"],
"viewText": "分享到:",
"viewSize": "16"
},
"selectShare": {
"bdContainerClass": null,
"bdSelectMiniList": ["weixin", "qzone", "tsina"]
}
};
with (document) 0[(getElementsByTagName('head')[0] || body).appendChild(createElement('script')).src = 'http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion=' + ~(-new Date() / 36e5)];
</script>


<!--gitter 聊天室 -->
<script>
Expand Down
1 change: 1 addition & 0 deletions docs/source_code/配置文件.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ WEBDRIVER = dict(
timeout=30, # 请求超时时间
window_size=(1024, 800), # 窗口大小
executable_path=None, # 浏览器路径,默认为默认路径
render_time=0, # 渲染时长,即打开网页等待指定时间后再获取源码
)

# 重新尝试失败的requests 当requests重试次数超过允许的最大重试次数算失败
Expand Down
2 changes: 1 addition & 1 deletion feapder/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4.3
1.4.4
4 changes: 4 additions & 0 deletions feapder/network/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,10 @@ def get_response(self, save_cached=False):

try:
browser.get(self.url)
render_time = setting.WEBDRIVER.get("render_time", 0)
if render_time:
tools.delay_time(render_time)

html = browser.page_source
response = Response.from_dict(
{
Expand Down
1 change: 1 addition & 0 deletions feapder/setting.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
timeout=30, # 请求超时时间
window_size=(1024, 800), # 窗口大小
executable_path=None, # 浏览器路径,默认为默认路径
render_time=0, # 渲染时长,即打开网页等待指定时间后再获取源码
)

# 重新尝试失败的requests 当requests重试次数超过允许的最大重试次数算失败
Expand Down
1 change: 1 addition & 0 deletions feapder/templates/project_template/setting.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
# timeout=30, # 请求超时时间
# window_size=(1024, 800), # 窗口大小
# executable_path=None, # 浏览器路径,默认为默认路径
# render_time=0, # 渲染时长,即打开网页等待指定时间后再获取源码
# )
#
# # 重新尝试失败的requests 当requests重试次数超过允许的最大重试次数算失败
Expand Down

0 comments on commit 544c27c

Please sign in to comment.