Skip to content

Commit

Permalink
修改空返回值是空generator的处理,避免出现StopIteration错误 (#247)
Browse files Browse the repository at this point in the history
  • Loading branch information
MiderWong authored and chyroc committed Apr 2, 2019
1 parent f936931 commit f3a58d2
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions wechatsogou/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,11 @@ def get_gzh_info(self, wecgat_id_or_name, unlock_callback=None, identify_image_c
'authentication': '' # 认证
}
"""
info = self.search_gzh(wecgat_id_or_name, 1, unlock_callback, identify_image_callback)
if not info:
return None
if decode_url:
info = self.search_gzh(wecgat_id_or_name, 1, unlock_callback, identify_image_callback, decode_url)
try:
return next(info)

return info
except StopIteration:
return None

def search_gzh(self, keyword, page=1, unlock_callback=None, identify_image_callback=None, decode_url=True):
"""搜索 公众号
Expand Down

0 comments on commit f3a58d2

Please sign in to comment.