Fork me on GitHub

Python常用工具类

工具类

wifi二维码

wifiqrcode.py

# pip install qrcode
import qrcode

def wifi_qr_generator(wifi_name, password, encrption='WPA'):
    wifi_template = f'WIFI:S:{wifi_name};T:{encrption};P:{password};;'
    qr = qrcode.QRCode(
        version=1,
        box_size=10,
        border=4,
    )
    qr.add_data(wifi_template)
    qr.make(fit=True)
    qr_img = qr.make_image(fill='black', back_color='white')
    qr_img.save('wifi_qr.png')

if __name__ == '__main__':
    wifi_qr_generator('ChinaNet', 'pwd')
posted @ 2024-06-26 14:38  秋夜雨巷  阅读(38)  评论(0编辑  收藏  举报