Skip to main content

MySoftBank dataTraffic

Project description

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_)

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

If you're not sure about the file name format, learn more about wheel file names.

MySB_datatraffic-4.1-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file MySB_datatraffic-4.1-py3-none-any.whl.

File metadata

  • Download URL: MySB_datatraffic-4.1-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for MySB_datatraffic-4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7c94a69649cea1e67d0cc672ea9ca89c0e94e7900f15da770fab32f5f9db98a7
MD5 72df1152bc763d94fd8bd44d8bb7532a
BLAKE2b-256 d518d3b10c7e634460c20f5404cb3c33de94839be414e82206cb61fa78095d78

See more details on using hashes here.

Supported by

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