Skip to main content

A complete wechat personal account api

Project description

itchat is a open souce wechat api project for personal account.

It enables you to access your personal wechat account through command line.

Here is the document.

So enjoy:)

Try

You may have a try of the robot based on this project first:

QRCodeOfRobot

Here is the code.

Installation

pip install itchat

Simple uses

import itchat, time

@itchat.msg_register(['Text', 'Map', 'Card', 'Note', 'Sharing'])
def text_reply(msg):
    itchat.send('%s: %s'%(msg['Type'], msg['Text']), msg['FromUserName'])

@itchat.msg_register(['Picture', 'Recording', 'Attachment', 'Video'])
def download_files(msg):
    fileDir = '%s%s'%(msg['Type'], int(time.time()))
    msg['Text'](fileDir)
    itchat.send('%s received'%msg['Type'], msg['FromUserName'])
    itchat.send('@%s@%s'%('img' if msg['Type'] == 'Picture' else 'fil', fileDir), msg['FromUserName'])

@itchat.msg_register('Friends')
def add_friend(msg):
    itchat.add_friend(**msg['Text'])
    itchat.get_contract()
    itchat.send('Nice to meet you!', msg['RecommendInfo']['UserName'])

@itchat.msg_register('Text', isGroupChat = True)
def text_reply(msg):
    if msg['isAt']:
        itchat.send(u'@%s\u2005I received: %s'%(msg['ActualNickName'], msg['Content']), msg['FromUserName'])

itchat.auto_login()
itchat.run()

FAQ

Why I can’t send files whose name is encoded in utf8?

That’s because of the upload setting of requests, you can put this file into packages/urllib3 of requests package.

Comments

If you have any problems or suggestions, you can talk to me in this issue

Or on gitter.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

itchat-1.0.13.zip (14.4 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

itchat-1.0.13-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

itchat-1.0.13-py2-none-any.whl (12.8 kB view details)

Uploaded Python 2

File details

Details for the file itchat-1.0.13.zip.

File metadata

  • Download URL: itchat-1.0.13.zip
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for itchat-1.0.13.zip
Algorithm Hash digest
SHA256 05749f2aaf32eb597bd02df047ba5f4f7a87534466a0edb561158306bdad51d3
MD5 271661bf44029cb88afb6cba76681b53
BLAKE2b-256 fdb8cb689c5b9366e993a13a337c8e4f2244e4dea46016f323d2ac760a45a0fe

See more details on using hashes here.

File details

Details for the file itchat-1.0.13-py3-none-any.whl.

File metadata

File hashes

Hashes for itchat-1.0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 3dad4456e2c793aea2271dca1e2ec42569ac4a5c30ddc0ea742b8b1fca93e149
MD5 3d5b7eb853c74883efe4740d5be65907
BLAKE2b-256 96830db9600b1782797a2eefe4964e41a3874f9c6a799c114ad73b3f18c856b0

See more details on using hashes here.

File details

Details for the file itchat-1.0.13-py2-none-any.whl.

File metadata

File hashes

Hashes for itchat-1.0.13-py2-none-any.whl
Algorithm Hash digest
SHA256 7919850ee8ff3c5b8132a71aa34832a9f022651dd36af39f0a3ffa18e3258d62
MD5 5f3d8f8db16ff0f7f42111e07ff09380
BLAKE2b-256 83a8bf7d44ff8c49d4ad2e380822f91de705e5580623d31beb6016b759608095

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page