Skip to main content

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

MySB_datatraffic-2.0-py3-none-any.whl (3.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page