Reference Documentation:
Python QR code generation Library QRCode installation and use example: http://www.jb51.net/article/58579.htm
vcard Format Parameters detailed description: http://www.phpin.net/thread-280-1-1.html
QR code generation tool: Http://tools.jb51.net/transcoding/jb51qrcode
Preparation environment:
System version: CentOS release 6.5
Installing Pip:yum Install Python-pip
Installing QRCODE:PIP Install QRCode
Installation web.py: official website download package: web.py-0.40.dev0.tar.gz
Install PIL: Download package: wget http://effbot.org/media/downloads/Imaging-1.1.5.tar.gz
To create a directory:
Project directory:/root/erweima
The entire directory structure is as follows,
[Email protected] erweima]# tree
.
├──static
│├──cardimg
│├──css
││└──animate.css
│├──images
││├──banner.jpg
││├──logo.png
││└──sss.png
│└──js
│└──jquery.min.js
├──templates
│└──index.html
├──weixin.py
└──weixin.pyc
Code writing:
List part of the code
[email protected] erweima]# cat weixin.py
#-*-coding:utf-8-*-
Import Web
Import QRCode
Import time
From PIL import Image
URLs = (
'/', ' Index '
)
Render = Web.template.render (' templates ')
def Code (info):
......
Return Imgpath
Class Index (object):
def GET (self):
Return Render.index ()
def POST (self):
info = Web.input ()
Print Info
return Code (Info)
if __name__ = = ' __main__ ':
Web.application (Urls,globals ()). Run ()
Test:
Launch, page generation QR code
Use the account sweep code, inside is an address book, can save to phone address book. (QQ can also be swept)
Python create two-dimensional code address Book