[Python] CliでPastebin.comに手軽にペーストするやつ

サーバーでゴニョゴニョしている時に、あぁこれPastebin.comに簡単に上げれたら楽なのに…って思ったのでpythonで簡単に上げるスクリプトを書きました。
引数処理はdocopt使えばよかった…
Python3以上対応です。

Githubに置いてます。
https://github.com/ir1s-work/easy_to_paste

10行目のdev_keyはhttps://pastebin.com/apiにある自身のUnique Developer API Keyを入れてください。

-l オプションを抜くとゲストでペーストされます。

Usage


    pastebin.py 
    pastebin.py [-f | --file] [-t | --title] [-s | --syntax] [-e | --expire] [-l | --login] [-p | --private]
    pastebin.py [-h | --help]

Options:


    -f --file         Your paste file.
    -t --title      The name or title of your paste
    -s --syntax     Your paste format.
    -e --expire     The expiration date of your paste.
                            N = Never, 10M = 10 mins, 1H = 1 hour, 1D = 1 day, 2W = 2 weeks,
                            1M = 1 month, 6M = 6 months, 1Y = 1 year.
    -l --login              Your paste will belong to your account.
    -p --private       1 -> Private, 2 -> Unlisted, 0 -> Public. (Default:0)

Examples:


    $ python pastebin.py ~/paste.py
      https://pastebin.com/hKDj1gPu
      
    $ python pastebin.py ~/paste.py -t paste.py -s python -l -p 2
      https://pastebin.com/VWFTMg2u

SNSでもご購読できます。

コメントを残す