猫史档案馆


【Python作品分享】自己的信息【作品秀】

用户:rs萌萌熊rs萌萌熊查看:0 回复:0 评论:0 创建时间:2020-04-13T18:16:30


【作品展示】

center_image

 

【作品介绍】

根据客户挂机一个号

 

【作品源代码】

import requests
import json
import easygui

def gzs():

    # 获取编程猫工作室排行JSON
    r = requests.get(
        'https://api.codemao.cn/web/shops/ranking?start=1&end=300')
    r.encoding = 'utf-8'
    r = r.text
    # 以上是把界面里面的JSON提取出来,方便下面的调用!
    r = json.loads(r)
    # 编程猫个人姓名
    name=[]
    idd=[]
    for i in range(300):
        name.append("第"+str(i+1)+"名:"+r['items'][i]['name'])
        idd.append(r['items'][i]['work_subject_id'])
        i += 1
    dic = dict(map(lambda x, y: [x, y], name, idd))
    choices = easygui.choicebox(msg='以下是工作室排行前300名!',
                                title='编程猫工作室排行前300',
                                choices=name)
    index = ''.join(choices)

    # 获取编程猫工作室排行JSON
    rr = requests.get(
        'https://api.codemao.cn/web/shops/'+str(dic[index])+'/users?limit=40&offset=0')
    rr.encoding = 'utf-8'
    rr = rr.text
    # 以上是把界面里面的JSON提取出来,方便下面的调用!
    rr = json.loads(rr)
    print(rr)
    name = []
    idd=[]
    for i in range(40):
        try:
            name.append(rr['items'][i]['name'])
            idd.append(rr['items'][i]['user_id'])
            i += 1
        except:
            dic = dict(map(lambda x, y: [x, y], name, idd))
            choices = easygui.choicebox(msg='以下是'+index+'的成员!',
                                title='编程猫工作室成员',
                                choices=name)
            index = ''.join(choices)
    # 获取编程猫工作室成员JSON
            r = requests.get(
                        'https://api.codemao.cn/api/user/info/detail/'+str(dic[index]))
            r.encoding = 'utf-8'
            r = r.text
    # 以上是把界面里面的JSON提取出来,方便下面的调用!
            r = json.loads(r)
            namee = r['data']['userInfo']['user']['nickname']
            qm = r['data']['userInfo']['user']['description']
            zz = r['data']['userInfo']['user']['doing']
            tjzp = r['data']['userInfo']['work']['name']
            tjzpid = r['data']['userInfo']['work']['id']
            easygui.msgbox(msg="用户名称:"+namee+"\n用户介绍:"+qm+"\n用户正在做:"+zz+"\n用户推荐作品:"+tjzp,
                   title="编程猫用户资料", ok_button="好的")
            break




    
    

    


gzs()


 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页