猫史档案馆


蒟蒻OIer1048576

蒟蒻OIer1048576

Lv.1

只是喜欢Python而已……徒弟:程序侯

获赞:206收藏:39浏览:2002作品收藏:29

签名:只是喜欢Python而已…… 徒弟:程序侯

回复帖子评论
上一页13 页 / 共 60下一页

蟹蟹委员 ~~ 中回复

???

2020-05-31T08:33:56 点赞:0

招Python徒弟啦! 中回复

我有QQ了

2020-05-31T08:40:04 点赞:0

招Python徒弟啦! 中回复

creeper? awww man so we back in the mine got our pick axe swinging from s2s,ss2s

2020-05-31T08:48:12 点赞:0

『招募』月狼工作室找人喽 中回复

挖坟坟

2020-05-31T09:38:52 点赞:0

【Python作品分享】新的作品-11【作品秀】 中回复

大型积木游戏

2020-05-31T13:00:39 点赞:0

Python竞赛呀 中回复

喵'

2020-05-31T13:01:05 点赞:0

解散事件关系到你们工作室 中回复

⊙0⊙

2020-05-31T13:02:00 点赞:0

Python竞赛呀 中回复

ddd

2020-05-31T13:21:21 点赞:0

Python竞赛呀 中回复

d'd'd'd'd'd'

2020-05-31T14:08:55 点赞:0

Python竞赛呀 中回复

creeper?

2020-05-31T14:09:00 点赞:0

论坛管喵,来封我号啊 中回复

import requests
from json import dumps, loads
from bs4 import BeautifulSoup


class codemaoAPI(object):
    def __init__(self, identity, password,
                 UA='Mozilla/5.0 (Windows NT 10.0; ) AppleWebKit/537.36 (KH喵L, like Gecko) Chrome/81.0.4044.138 Safari/537.36',
                 debug=False):
        self.debug = debug
        self.ses = requests.session()
        self.headers = {"Content-Type": "application/json", "User-Agent": UA}
        self.log('getting pid...')
        soup = BeautifulSoup(requests.get('https://shequ.codemao.cn', headers = self.headers).text, 'html.parser')
        pid = loads(soup.find_all("script")[0].string.split("=")[1])['pid']
        self.log('Successfully get pid;pid=' + pid)
        self.log('loginning...')
        a = self.ses.post('https://api.codemao.cn/tiger/v3/web/accounts/login', headers = self.headers,
                          data = dumps({"identity": identity, "password": password, "pid": pid}))
        if a.status_code == 200:
            self.log("Successfully login to codemao.cn")
        else:
            self.log('End of login to codemao.cn;response', a.status_code)

    def log(self, *msg):
        if self.debug:
            print(*msg)

    def send_post(self, board, title, message):
        self.log('posting...')
        a = self.ses.post(f'https://api.codemao.cn/web/forums/boards/{board}/posts', headers = self.headers,
                          data = dumps({'title': title, 'content': message}))
        self.log('End.response', a.status_code)

    def replies(self, postID, message):
        self.log('replieing...')
        a = self.ses.post(f'https://api.codemao.cn/web/forums/posts/{postID}/replies', headers = self.headers,
                          data = dumps({'content': message}))
        self.log('End.response', a.status_code)

    def __delete_work(self, workID):  # BUG
        self.log('deleting...')
        a = self.ses.delete(f'https://api.codemao.cn/tiger/work/{workID}/temporarily', headers = self.headers)
        self.log('End.response', a.status_code)

    def __recove_work(self, workID):  # BUG
        self.log('recoving...')
        a = self.ses.patch(f'https://api.codemao.cn/tiger/work/{workID}/recover', headers = self.headers)
        self.log('End.response', a.status_code)

    def __permanent_work(self, workID):  # BUG
        self.log('permanenting...')
        a = self.ses.delete(f'https://api.codemao.cn/tiger/work/{workID}/permanently', headers = self.headers)
        self.log('End.response', a.status_code)

    def delete_all_work(self):
        self.log('All work are permanenting...')
        a = self.ses.delete('https://api.codemao.cn/tiger/work/user/works/permanently', headers = self.headers)
        self.log('End.response', a.status_code)

    def send_post_to_work_shop(self, work_shop_ID, message):
        self.log('posting...')
        a = self.ses.post(f'https://api.codemao.cn/web/discussions/{work_shop_ID}/comment', headers = self.headers,
                          data = dumps({"content": message, "rich_content": message, "source": "WORK_SHOP"}))
        self.log('End.response', a.status_code)

    def top_replies(self, repliesID):
        self.log('On top...')
        a = self.ses.put(f'https://api.codemao.cn/web/forums/replies/{repliesID}/top', headers = self.headers,
                         data = r'{}')
        self.log('End.response', a.status_code)

    def untop_replies(self, repliesID):
        self.log('Untop...')
        a = self.ses.delete(f'https://api.codemao.cn/web/forums/replies/{repliesID}/top', headers = self.headers)
        self.log('End.response', a.status_code)

    def like_replies(self, repliesID):
        self.log('liking...')
        self.ses.put(f'https://api.codemao.cn/web/forums/comments/{repliesID}/liked?source=REPLY',
                     headers = self.headers, data = r'{}')
        self.log('End.response', a.status_code)

    def unlike_replies(self, repliesID):
        self.log('Unliking...')
        self.ses.delete(f'https://api.codemao.cn/web/forums/comments/{repliesID}/liked?source=REPLY',
                        headers = self.headers)

2020-06-01T08:43:23 点赞:0

论坛管喵,来封我号啊 中回复

Click me

2020-06-01T08:50:27 点赞:0

论坛管喵,来封我号啊 中回复

测试

2020-06-01T09:39:14 点赞:0

论坛管喵,来封我号啊 中回复

我是3.7的PyCharm

2020-06-01T12:12:36 点赞:0

多种语言一起学【01】Hello,World 中回复

2020-06-02T08:48:38 点赞:0

论坛管喵,来封我号啊 中回复

GUIMaker文档 menu GUIMaker | 文档 GuiMaker介绍 GuiMaker的GUI类 GuiMaker介绍 star fork

guimaker由1048576,未入门的程序员和Toby共同开发,是一个基于tkinter的简易、轻量级的Python gui。使用它,您可以轻松的写出一个GUI程序。

GuiMaker的GUI类

"

2020-06-03T08:04:55 点赞:0

【社区风纪】社区不等于法外之地 中回复

顶一顶

2020-06-03T08:12:00 点赞:0

【社区处罚公示】2·听说你在盗号?律师函警告! 中回复

我只是个测试

2020-06-03T08:14:47 点赞:0

【社区处罚公示】2·听说你在盗号?律师函警告! 中回复

PY交易??

2020-06-03T08:15:39 点赞:0

论坛管喵,来封我号啊 中回复

这是我写的图形化自动回复机

v i p

2020-06-03T08:18:11 点赞:0

Python竞赛呀 中回复

 

2020-06-03T08:31:54 点赞:0

论坛管喵,来封我号啊 中回复

2020-06-03T08:47:23 点赞:0

顶帖神器!! 中回复

2020-06-03T08:54:56 点赞:0

顶帖神器!! 中回复

喵d

2020-06-03T09:00:26 点赞:0

彩虹字怎么弄 中回复

<form action=" https://www.qqxiuzi.cn/zh/caihongzi/index.htm" method="post" name="form1">

 

</form>

2020-06-03T09:22:21 点赞:0

梦想一队找人!!! 中回复

dd

2020-06-03T09:22:45 点赞:0

梦想一队找人!!! 中回复

 

2020-06-03T10:33:47 点赞:0

【社区风纪】社区不等于法外之地 中回复

def 社区是法外之地():
    return False

2020-06-03T11:12:05 点赞:0

梦想一队找人!!! 中回复

2020-06-03T11:26:02 点赞:0

新制度(审核中) 中回复

1

2020-06-03T11:26:50 点赞:0