MySoftBank dataTraffic
Project description
MySB_dataTraffic
MySoftBankをスクレイピングしてデータ残量をLINEに通知するやつ
Install
$ pip3 install MySB-datatraffic
How to use
LINE通知にはLINE Notifyを使用するのでアクセストークンを取得しておく。
インポート
import MySBdt
telnum、password、line_access_tokenを自分のものに置き換える。
telnum = 'your_phone_number'
password = 'your_mysoftbank_password'
line_access_token = 'your_line_access_token'
インスタンスを作成
api = MySBdt.API(telnum=telnum, password=password, line_access_token=line_access_token)
データ(総量、残量、使用量、割合、前月繰越分)の取得
data = api.get()
print(data)
# 実行結果
# {'total': '5.00', 'remain': '3.78', 'used': '1.22', 'rate': '75.6', 'bf': '0.00'}
LINEに通知する
api.line()
実行すると以下のような情報がLINEに通知される。戻り値はrequestsのHTTPステータスコードが返る。ログインに失敗した時やMySoftbankがメンテナンス中の時、htmlが変更された時にはデータ量に0.00が代入される。
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for MySB_datatraffic-3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b99503dcf200590b2fc810b0f7a967416f427ef433f6d5299099e2a5fd4798d |
|
MD5 | 62081708bce548ccb6eb69c4fc8ea8cb |
|
BLAKE2b-256 | af1b91177dfb62ab72a6060fc9d85090a9b7bf83de0cc3473ec05a39dcc96bf1 |