Skip to content

Commit

Permalink
fixed base demo20
Browse files Browse the repository at this point in the history
  • Loading branch information
mgss committed Nov 9, 2017
1 parent fc37a6e commit 3029fde
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/basic.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,6 @@ PS:字典中的value只能是字符串或列表

## Demo-20

* 利用第三方接口实现输入QQ号判断是否在线
* 利用第三方接口和第三方模块实现输入QQ号判断是否在线

参考Demo:[链接](https://github.com/mgss/python-demo/blob/master/example/basic/demo20.py)
9 changes: 9 additions & 0 deletions example/basic/demo20.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@


def is_online(qq_num):
"""
调用第三方接口,查询qq号码是否在线
:param qq_num: QQ号码,String
:return: node.text String
"""
data = requests.get("http://www.webxml.com.cn/webservices/qqOnlineWebService.asmx/qqCheckOnline?qqcode=%s" % qq_num)
result = data.text
node = ET.XML(result)
Expand All @@ -16,6 +21,10 @@ def is_online(qq_num):


def main():
"""
主函数
:return: None
"""
inp = input("请输入要查询的QQ号:")
result = is_online(inp)
if result == "Y":
Expand Down

0 comments on commit 3029fde

Please sign in to comment.