Skip to main content

MySB_dataTraffic

MySoftBankをスクレイピングしてデータ残量をLINEに通知するやつ

Install

GitHubから直接Cloneすることを推奨します。この方法の場合はMySB_dataTrafficディレクトリ内のsample.pyを書き換えることで使用することができます。

$ git clone https://github.com/0x0u/MySB_dataTraffic
$ cd MySB_dataTraffic

pipでのインストールも可能です。

$ pip3 install MySB-datatraffic

How to use

ライブラリのインポート

import MySBdt

LINE通知にはLINE Notifyを使用するのでアクセストークンを取得しておく必要があります。telnum、password、line_access_tokenを自分のものに置き変えます。

telnum = "電話番号"
password = "MySoftbankのパスワード"
line_access_token = "LineNotifyのアクセストークン"

インスタンスを作成

api = MySBdt.API(telnum=telnum, password=password, line_access_token=line_access_token)

データ(使用量、残量、繰越残量、追加量、追加使用量、追加繰越量、追加繰越使用量)の取得ができます。

data = api.get_data()
print(data)

# 実行結果
# {'used_data': 6.34, 'remain_data': 0.02, 'step_remain_data': 0.0, 'additional_data': 1.0, 'additional_used_data': 0.98, 'given_data': 0.36, 'given_used_data': 0.36}

LINEに通知します。

status = api.send_message()
print(status)

# 実行結果
# 200

実行すると以下のような情報がLINEに通知されます。戻り値はrequestsのHTTPステータスコードが返ります。

Author

@qxi_(https://twitter.com/qxi_)

Metadata

Release files for MySB-datatraffic 4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for MySB-datatraffic 4.1
File Interpreter ABI Platform Actions
MySB_datatraffic-4.1-py3-none-any.whl Python 3 none any Details for MySB_datatraffic-4.1-py3-none-any.whl

Release files / MySB_datatraffic-4.1-py3-none-any.whl

Download URL MySB_datatraffic-4.1-py3-none-any.whl
Size 3.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7c94a69649cea1e67d0cc672ea9ca89c0e94e7900f15da770fab32f5f9db98a7
BLAKE2b-256 checksum
How to use checksums
d518d3b10c7e634460c20f5404cb3c33de94839be414e82206cb61fa78095d78
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.6

Security for MySB-datatraffic 4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page