def weibo_api(): (wei_session, uid) = wblogin() if uid is not None: wei_session.get('http://weibo.com/') return WeiboSender(wei_session, uid) return None
# -*- coding: utf-8 -*- import send_task from weibo.weibo_login import wblogin # from weibo.weibo_qrcode import wblogin if __name__ == '__main__': (wei_session, uid) = wblogin() if uid is not None: wei_session.get('http://weibo.com/') task = send_task.SendTask(wei_session, uid) task.start() while True: cmd = input('enter [exit] to stop:') if cmd.upper() == "EXIT": task.stop() break print('exit...')
# -*- coding: utf-8 -*- # 自动发微博 form github import send_task from weibo.weibo_login import wblogin if __name__ == '__main__': (http, uid) = wblogin() http.get('http://weibo.com/') task = send_task.SendTask(http, uid) task.start() task.stop()
if not rt_exist: msg.rt_mid = DELETED_MID if len(msg.text) > 140: msg.text = msg.text[:135] + "[...]" for pic in pics: pids.append(pic['pid']) msg.pids = "|".join(pids) return msg if args.session_file: with open(args.session_file, 'rb') as f: session = pickle.load(f) uid = args.uid else: session, uid = wblogin() print('uid: ', uid) with open('sender.sess', 'wb') as f: pickle.dump(session, f) # load json json_data: Dict[str, Any] = dict() with open(args.json_file, 'r') as f: json_data = json.load(f) if not json_data: logger.info(f'Failed to laod json data from {args.json_file}.') exit(1) sender = WeiboSender(session, uid)
def loginCfg(self): (http, uid) = wblogin() http.get('http://weibo.com/') self.sender = WeiboSender(http, uid)
# -*- coding: utf-8 -*- import send_task from weibo.weibo_login import wblogin if __name__ == "__main__": (http, uid) = wblogin() http.get("http://weibo.com/") task = send_task.SendTask(http, uid) task.start() # task.stop()