We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello Mr.Twitter
echo "Hello Mr.Twitter " | python twitter/create.py | jq --raw-output '.["id_str"]' | python twitter/destroy.py | jq .
CONSUMER_KEY = '' CONSUMER_SECRET = '' ACCESS_TOKEN = '' ACCESS_TOKEN_SECRET = ''
# https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-statuses-update import json, config, os, re, urllib.parse, unicodedata, sys from requests_oauthlib import OAuth1Session CK = config.CONSUMER_KEY CS = config.CONSUMER_SECRET AT = config.ACCESS_TOKEN ATS = config.ACCESS_TOKEN_SECRET twitter = OAuth1Session(CK, CS, AT, ATS) message = '' for line in sys.stdin: message += re.sub(r'^\s+|\s+$', '', line) formatted_message = re.sub(r'\\n', "\n", message) formatted_message = formatted_message[:140] encoded_message = urllib.parse.quote_plus(formatted_message) tweet = { "status" : encoded_message, "in_reply_to_status_id" : os.environ.get('IN_REPLY_TO_STATUS_ID') if os.environ.get('IN_REPLY_TO_STATUS_ID') else '', "auto_populate_reply_metadata" : 'true', } url = "https://api.twitter.com//1.1/statuses/update.json?status={status}&in_reply_to_status_id={in_reply_to_status_id}&auto_populate_reply_metadata={auto_populate_reply_metadata}".format(**tweet) if os.environ.get("DEBUG"): print(url) else: res = twitter.post(url) print(json.dumps(res.json()))
# https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-statuses-destroy-id.html import json, config, re, sys, os from requests_oauthlib import OAuth1Session CK = config.CONSUMER_KEY CS = config.CONSUMER_SECRET AT = config.ACCESS_TOKEN ATS = config.ACCESS_TOKEN_SECRET twitter = OAuth1Session(CK, CS, AT, ATS) for line in sys.stdin: id = line.strip() api_url = 'https://api.twitter.com/1.1/statuses/destroy/{id}.json'.format(**{ "id" : id }) res = twitter.post(api_url) print(json.dumps(res.json()))
ツールボックスに道具を揃えて、使い分けられるエンジニアになりたい。
エンジニア勉強会に参加しないエンジニア。俺です。だけど一番行って良かったと思ったのはRubyKaigi大阪01だ。@yuki24 さんの発表は本当に頭に残ってる。ツールボックスを使い分ける。ちなみに僕もLT枠で登壇した。— 0 (@YumaInaura) February 18, 2019
エンジニア勉強会に参加しないエンジニア。俺です。だけど一番行って良かったと思ったのはRubyKaigi大阪01だ。@yuki24 さんの発表は本当に頭に残ってる。ツールボックスを使い分ける。ちなみに僕もLT枠で登壇した。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Twitterでツイートして、すぐにそれを削除する例
Hello Mr.Twitter
を標準出力するイメージ
script - config.py
script - create.py
script - destroy.py
ひとこと
ツールボックスに道具を揃えて、使い分けられるエンジニアになりたい。
The text was updated successfully, but these errors were encountered: