Comments (10)
@9cat 再次运行程序还是失败吗?
from itchat.
@littlecodersh 是的, 是需要修改appid之类的吗? 另外,我不在**境内, 会有影响吗?
from itchat.
from itchat.
from itchat.
试试看这个测试程序:
import requests, itchat, platform, subprocess, os
uuid = itchat.get_QRuuid()
url = '%s/qrcode/%s'%('https://login.weixin.qq.com', uuid)
r = requests.get(url, stream = True)
QR_DIR = 'QR.jpg'
with open(QR_DIR, 'wb') as f: f.write(r.content)
if platform.system() == 'Darwin':
subprocess.call(['open', QR_DIR])
elif platform.system() == 'Linux':
subprocess.call(['xdg-open', QR_DIR])
else:
os.startfile(QR_DIR)
from itchat.
出现找不到文件: (不过我在目录中倒是看到QR.jpg , 另外,我用的是VPS,console, 应该没法直接打开QR.jpg)
Traceback (most recent call last):
File "test3.py", line 11, in <module>
subprocess.call(['xdg-open', QR_DIR])
File "/usr/lib/python2.7/subprocess.py", line 522, in call
return Popen(*popenargs, **kwargs).wait()
File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1335, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
from itchat.
@9cat 那就需要找一个方法显示二维码,我这里有一个基础的解决方案:这里
from itchat.
我这样就能显示了, 加了一个 ”./ “
import requests, itchat, platform, subprocess, os
uuid = itchat.get_QRuuid()
url = '%s/qrcode/%s'%('https://login.weixin.qq.com', uuid)
r = requests.get(url, stream = True)
QR_DIR = "./QR.jpg"
print uuid
with open(QR_DIR, 'wb') as f: f.write(r.content)
print QR_DIR
if platform.system() == 'Darwin':
subprocess.call(['open', QR_DIR])
elif platform.system() == 'Linux':
subprocess.call(['cacaview', QR_DIR])
else:
os.startfile(QR_DIR)
from itchat.
这个QRCODE 显示有意思:
import requests, itchat, platform, subprocess, os
from PIL import Image
import sys
BLOCK = 'MM'
class QRCode():
def __init__(self, fileName, size, padding = 0, background = 'BLACK'):
self.size = size
self.padding = padding
self.img = Image.open(fileName)
self.times = self.img.size[0]/(size + padding * 2)
self.rgb = self.img.convert('RGB')
self.white = BLOCK if background == 'BLACK' else ' '
self.black = ' ' if background == 'BLACK' else BLOCK
def print_qr(self):
sys.stdout.write(' '*50 + '\r')
sys.stdout.flush()
print(self.white * (self.size + 2))
startPoint = self.padding + 0.5
for y in range(self.size):
sys.stdout.write(self.white)
for x in range(self.size):
r,g,b = self.rgb.getpixel(((x + startPoint) * self.times, (y + startPoint) * self.times))
sys.stdout.write(self.white if r > 127 else self.black)
print(self.white)
print(self.white * (self.size + 2))
uuid = itchat.get_QRuuid()
url = '%s/qrcode/%s'%('https://login.weixin.qq.com', uuid)
r = requests.get(url, stream = True)
QR_DIR = './QR.jpg'
print uuid
with open(QR_DIR, 'wb') as f: f.write(r.content)
print QR_DIR
if platform.system() == 'Darwin':
subprocess.call(['open', QR_DIR])
elif platform.system() == 'Linux':
# subprocess.call(['cacaview', QR_DIR])
q = QRCode(QR_DIR, 37, 3, 'BLACK')
q.print_qr()
else:
os.startfile(QR_DIR)
from itchat.
@littlecodersh 感谢, 大功告成! 能自动回复所以有信息了。
from itchat.
Related Issues (20)
- Hi how i yours the App
- 现在微信网页版无法登录,还能用itchat吗 HOT 11
- iPhone手机上的8.0.43版本微信是不是改VOIP了?
- 视频号 HOT 1
- ???
- 错误
- 17年6月下旬前登陆过web网页版的微信可以使用此框架,验证微信是否支持web版本API,请点击https://wx.qq.com/ ,扫码验证即可,假如出现无法登陆,则不适用于此框架 HOT 3
- itchat.send_video 运行没有效果 HOT 2
- 如何获得微信群群人数
- 【无法登录】“为了保障你的账号安全,暂不支持使用网页版微信。你可以前往微信官网” HOT 3
- ?
- ?
- 可以与jenkins集成吗?将jenkins构建的结果推送到普通微信群中
- 关于thread过时
- 获取什么作为群聊用户的永久唯一标识? HOT 4
- set_alias修改好友备注接口怎么没有生效 HOT 3
- 我在登录后出现'xml.parsers.expat.ExpatError: mismatched tag: line 64, column 4' 怎么解决 HOT 9
- 国务院的人都是一群鲨跸 HOT 4
- 【!!!研发必看!!!】替代UOS WEB版,做机器人,小助手,营销系统,客服系统,监管系统的可以 看下这个API方案 HOT 5
- 能根据手机号获取微信头像昵称吗?个人签名。 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from itchat.