Skip to content

as209099/invoice-python-lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

invoice-python-lib

中華民國財政部統一發票 - Python

簡介

本程式主要用於取得中華民國財政部統一發票號碼,並用於發票號碼兌獎。

安裝

本地端安裝

git clone git@github.com:as209099/invoice-python-lib.git
python3 -m setup.py install

Pip PyPI安裝

pip install invoice

使用方法

# 初始化時會自動下載當期與上期統一發票之資料
>>> from invoice import Invoice
>>> invoice = Invoice()
# 取得當期民國年與月份
>>> invoice.get_years_and_months()
'111年05-06月'

# 取得當期的開獎發票號碼
>>> invoice.get_numbers()
[['特別獎', '46438476'],
['特獎', '54769852'],
['頭獎', '17858097'],
...]

# 也能取得上期的民國年與月份
>>> invoice.get_previous_years_and_months()
'111年03-04月'

# 以及上期的開獎發票號碼
>>> invoice.get_previous_numbers()
[['特別獎', '32220402'],
 ['特獎', '99194290'],
 ...,
 ['頭獎', '27854976']]
# 兌獎
>>> invoice_list = invoice.get_numbers()
>>> my_numbers = [
    '12345678',
    '12345677',
    ...,
    '123'
]
>>> prize_list = invoice.redeem(invoice_list, my_numbers)
>>> print(prize_list)
[
    ['12345678', None],
    ['12345677', '六獎'],
    ...,
    ['123', '格式有誤']
]

使用之Library

enjoy coding!

授權

採用MIT授權條款,可以自行運用,也可以發起Issue或Pull Request給我。

About

中華民國財政部統一發票 Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages