예제 #1
0
def test_exception():
    try:
        Shanbay('rxxxoot', 'axxbcd').login()
    except AuthException:
        pass

    try:
        proxies = {
            "http": "http://10.10.1.10:3128",
            "https": "http://10.10.1.10:1080",
        }
        Shanbay('rooxxt', 'abcxx').login(proxies=proxies, timeout=3)
    except ConnectException:
        pass
def test_shanbay():
    sb = Shanbay(USERNAME, PASSWORD)
    sb.login()
    print(sb.user_id)
    print(sb.team_id)
    print(sb.forum_id)
    print(sb.get_thread("3128002"))
예제 #3
0
 def test_user(self):
     try:
         s = Shanbay('ggppwx', '3006216088')
         s.login()
         api = DictAPI(s)
         user = api.user().json()
         print(user)
     except:
         pass
def test_task():
    """只能测试部分函数"""
    shanbay = Shanbay(USERNAME, PASSWORD)
    spider = Spider()
    agent = Agent(shanbay, spider)

    agent.thread_id = "3138247"
    agent.add_foot()
    result = agent.online_check()
    agent.local_record(result)
예제 #5
0
def test_login():
    s = Shanbay('root', 'root')
    s.login()
예제 #6
0
 def test_login(self):
     try:
         s = Shanbay('ggppwx', '3006216088')
         s.login()
     except:
         self.fail("login failure")
예제 #7
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from shanbay import Shanbay, Message

s = Shanbay('root', 'root')
s.login()
message = Message(s)


def test_send_message():
    assert message.send_message(['mozillazg'], 'test_send_message',
                                'test_send_message')


def test_reply_message():
    url = 'http://www.shanbay.com/message/thread/2687980/'
    assert message.reply_message(url, 'test_reply_message')
예제 #8
0
        content = f"今日活动报告:\n\r\n\r{content}"

        self.shanbay.reply_thread(self.thread_id, content)


curr_path = os.path.dirname(os.path.abspath(__file__))
checkin_log_path = os.path.join(curr_path, "../zhao-hua-xi-shi-checkin-log")
logfile = os.path.join(curr_path, "task.log")

logging.basicConfig(filename=logfile,
                    level='INFO',
                    format="%(asctime)s %(filename)s [%(funcName)s] [line: %(lineno)d]  %(message)s",
                    filemode='a')

if __name__ == '__main__':
    # 发帖
    shanbay = Shanbay(USERNAME, PASSWORD)
    spider = Spider()
    agent = Agent(shanbay, spider)
    agent.create_thread()

    # 5:00 - 8:00
    time.sleep(3600 * 3 + 10)

    # 查卡
    result = agent.online_check()
    agent.online_report(result)
    agent.git_pull()
    agent.local_record(result)
    agent.git_push()