Python建立二維碼通訊錄

來源:互聯網
上載者:User

標籤:info   結構   jquery   nim   get   url   wget   card   style   

參考文檔:

Python二維碼產生庫qrcode安裝和使用樣本:http://www.jb51.net/article/58579.htm

vCard格式參數詳細說明:http://www.phpin.net/thread-280-1-1.html

二維碼產生工具:http://tools.jb51.net/transcoding/jb51qrcode

 

準備環境:

系統版本:CentOS release 6.5

安裝pip:yum install python-pip

安裝qrcode: pip install qrcode

安裝web.py:官網下載包:web.py-0.40.dev0.tar.gz

安裝pil:下載包:wget http://effbot.org/media/downloads/Imaging-1.1.5.tar.gz

 

建立目錄:

項目目錄:/root/erweima

整個目錄結構如下,

[[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

 

代碼編寫:

列出部分代碼

[[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()

 

測試:

啟動,頁面產生二維碼

 

使用帳號掃碼,裡面是一個通訊錄,可以儲存到手機通訊錄。(qq也可以掃)

  

 

 

 

Python建立二維碼通訊錄

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.