Skip to main content

一、介绍

bossbot 是一个用 python 实现的、基于boss直聘 websocket 协议的机器人,可运行在 Linux, Windows 和 Mac OSX 平台下。

本项目 github 地址: https://github.com/xmiaoq/bossbot

你可以通过扩展 bossbot 来实现:

  • 监控、收集 boss直聘 消息
  • 自动消息推送
  • 简历发送
  • 聊天机器人

二、安装方法

在 Python 3.4+ 下使用,用 pip 安装:

pip install bossbot

三、实现你自己的 boss直聘 机器人

1、继承bossBot类,并重载对应函数

示例代码:

from bossbot import BossBot

class Bot(bossBot):

    def on_text_message(self, data, boss_id, msg):
        '''
        文本 消息回调函数。
        :param data: 收到的完整消息内容
        :param boss_id: 发送次消息的boss的id
        :param msg: 文本内容
        :return:
        '''
        print('收到文字消息:' + msg)
        # 回复文字消息你好
        self.send_message(boss_id, "你好")

    def on_request_resume_message(self, data, boss_id, mid):
        '''
        请求发送简历 消息回调函数
        :param data: 收到的完整消息内容
        :param boss_id: 发送次消息的boss的id
        :param mid: 消息id,如果需要同意或者拒绝,需要此id
        :return:
        '''
        print('收到boss:%s,请求发送一份简历!' % boss_id)
        #同意发送简历
        self.accept_resume(boss_id, mid, self.resumes[0]['resumeId'])

    def on_connect(self, client, userdata, flags, rc):
        '''
        websocket连接成功回调函数。
        :param client: 
        :param userdata: 
        :param flags: 
        :param rc: 
        :return: 
        '''
        print("websocket 连接成功!")

2、登陆你的boss直聘账号

    bot = Bot()
    # 扫二维码方式登陆
    bot.login()
    # 免扫码登陆,需要先通过扫码登陆,拿到对应账号信息。因为长期有效所以记录下来,直接使用。
    # bot.login(uid='xxxx', user_id="xxxxxxxxx", token="xxxxx")

    bot.start()

3、功能示例

    # 输出我的简历信息。
    print(json.dumps(self.resumes, ensure_ascii=False))
    # 输出与我最近沟通过的boss信息
    print(json.dumps(self.bosses, ensure_ascii=False))

    boss_id = list(self.bosses.keys())[0]
    resume_id = self.resumes[0]

    # 获取boss的详细信息,包含job信息
    boss_data = self.get_boss_data(boss_id)
    print(json.dumps(boss_data, ensure_ascii=False))

    # 获取与boss的历史聊天记录
    history_msg = self.get_history_msg(boss_id)
    print(json.dumps(history_msg, ensure_ascii=False))

    # 向boss发送文字消息
    # self.send_message(boss_id, "你好")

    # 向boss发送简历
    # self.request_send_resume(boss_id, resume_id)

四、待完成任务清单

  • 实时消息信息记录进历史消息
  • boss端登陆及使用

声明

本项目仅供技术研究,请勿用于任何商业用途,请勿用于非法用途,如有任何人凭此做何非法事情,均于作者无关,特此声明。

Metadata

Release files for bossbot 0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bossbot 0.3
File Size Uploaded Provenance Actions
bossbot-0.3.tar.gz 20.7 kB Without provenance Details for bossbot-0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bossbot 0.3
File Interpreter ABI Platform Actions
bossbot-0.3-py3-none-any.whl Python 3 none any Details for bossbot-0.3-py3-none-any.whl

Total release size: 41.3 kB

Release files / bossbot-0.3.tar.gz

Download URL bossbot-0.3.tar.gz
Size 20.7 kB
Tags Source
SHA-256 checksum
How to use checksums
dbad86158f4e5f8eae5febe5f75b271c2ca2a8f5936073994499434b0505fde5
BLAKE2b-256 checksum
How to use checksums
b61f9b182d9098fb33db9aee3e6251870e1f1e79123dd30682d47b3ecff68281
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.5

Release files / bossbot-0.3-py3-none-any.whl

Download URL bossbot-0.3-py3-none-any.whl
Size 20.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dd820ae39d88600691ddb975f8f34b233e24c36ab6e7aa0e8b8801eb5ae7794e
BLAKE2b-256 checksum
How to use checksums
f18ce29ecd3768b35d3b655225d9ab1f5bfb1f2a20d991db41126bb1dd7ef03c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.5

Security for bossbot 0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page