Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
Pythonの勉強がてら死活監視ツールを作った話
虎の穴ラボ株式会社
February 22, 2019
Programming
0
2k
Pythonの勉強がてら死活監視ツールを作った話
OSCのLT新人戦用に作成したスライド
pythonを使って自社サービスの監視ツールについて話します。
虎の穴ラボ株式会社
February 22, 2019
Tweet
Share
More Decks by 虎の穴ラボ株式会社
See All by 虎の穴ラボ株式会社
とらのあなラボTechConferenceVol.2_私、ECサイトはユーザーに使いやすくって言ったよね!〜とらのあな通販サイト 改善の取り組み〜
toranoana
0
130
クロスドメイントラッキングによる分析環境の構築
toranoana
0
130
OpenSearchで始める全文検索
toranoana
0
130
とらのあなラボTechConferenceVol.2_WAF-Athenaによるセキュリティ対策
toranoana
0
190
既存クラウドをTerraformで管理してみた
toranoana
0
5
【Tech Conference vol.2】コミュニケーションと技術を加速させるリモートワークペアプログラミング
toranoana
0
170
とらのあなラボTechConferenceVol.2_静的コンテンツのキャッシュ戦略見直しとリリース改善
toranoana
0
140
TechConference2_通販開発マネジメントの7ルール
toranoana
0
120
新規社内システムのモダンなフロントエンド開発について 〜開発の高速化でDXを促進!〜
toranoana
0
140
Other Decks in Programming
See All in Programming
読みやすいコードを書こう
yutorin
0
380
偏見と妄想で語るスクリプト言語としての Swift / Swift as a Scripting Language
lovee
1
150
New Relicを使った Observabilityの実現方法と活用例 / gocon 2022 spring after talk
budougumi0617
0
950
脱オブジェクト指向講座(5分LT資料)
kishida
8
11k
WindowsコンテナDojo:第2回 Windowsコンテナアプリのビルド、公開、デプロイ
oniak3ibm
PRO
0
140
UI State Modeling 어떤게 좋을까?
laco2951
1
200
WindowsコンテナDojo:準備編
oniak3ibm
PRO
0
460
Language Summit 2022: WebAssembly: Python in the browser and beyond
tiran
2
310
書籍『良いコード/悪いコードで学ぶ設計入門』でエンジニアリングの当たり前を変える
minodriven
3
1k
Angular's new Standalone Components: How Will They Affect My Architecture? @iJS London 2022
manfredsteyer
PRO
0
380
microCMS × Shopifyで、ECサイトがリニューアル後急成長した話
microcms
0
450
You CANt teach an old dog new tricks
michaelbukachi
0
110
Featured
See All Featured
The Invisible Customer
myddelton
110
11k
How to Ace a Technical Interview
jacobian
265
21k
Docker and Python
trallard
27
1.5k
Gamification - CAS2011
davidbonilla
75
3.9k
Git: the NoSQL Database
bkeepers
PRO
415
59k
Designing with Data
zakiwarfel
91
3.8k
Support Driven Design
roundedbygravity
86
8.4k
GraphQLの誤解/rethinking-graphql
sonatard
24
6.2k
What the flash - Photography Introduction
edds
61
9.8k
Large-scale JavaScript Application Architecture
addyosmani
499
110k
Building Your Own Lightsaber
phodgson
94
4.6k
What’s in a name? Adding method to the madness
productmarketing
11
1.5k
Transcript
Python !
1 2019/02/22 OSC LT Python ! Copyright © 2019 Toranoana Inc. All Rights Reserved.
. + . + . + . + . +
. + -!, 2 Copyright © 2019 Toranoana Inc. All Rights Reserved. 5" ( %$' 521 3* ') /05JavaJS 5 # & 5 4
3 Copyright © 2019
Toranoana Inc. All Rights Reserved. • Python? • • •
Python? !
JavaJavaScript ↓ "# 4 Copyright © 2019 Toranoana Inc. All Rights Reserved.
Python? 5
Copyright © 2019 Toranoana Inc. All Rights Reserved.
2 / 2 / 2 / 2 / 2 /
2 / ,-.3 1 6 Copyright © 2019 Toranoana Inc. All Rights Reserved. Web( AP( DB( nginx& nginxhttp https !" +)'4%6 KEEPER5 Rails& $ !$ #*0 MySQL& $ $* 0
7 Copyright ©
2019 Toranoana Inc. All Rights Reserved. Web AP DB Web http://toranoana-keeper.com/ HTTP HTTP301
8 Copyright ©
2019 Toranoana Inc. All Rights Reserved. Web AP DB AP https://toranoana-keeper.com/ (TOP ) HTTP200
" " " " " " #! 9 Copyright ©
2019 Toranoana Inc. All Rights Reserved. Web AP DB DB https://toranoana-keeper.com/search ( ) GET:'search[q]'='aaaa' HTTP200 % $
10 Copyright ©
2019 Toranoana Inc. All Rights Reserved. Web AP DB slack
#pyenv pyenv
install 3.6.8 pyenv local 3.6.8 #HTTP Requests pip install requests 11
&$ &$ &$ &$ &$ &$ )(Web )
# import requests #Web (allow_redirects=False ! (# ) url = "http://toranoana-keeper.com/" r = requests.get(url,allow_redirects=False) print (r.status_code, r.reason) ↓'%" 301 Moved Permanently 12
(AP) #
import requests #AP url = "https://toranoana-keeper.com/" r = requests.get(url) print (r.status_code, r.reason) ↓ 200 OK 13
(DB) #
import requests #DB url = "https://toranoana-keeper.com/search" r = requests.get(url,params={'search[q]': 'aaaa'}) print (r.status_code, r.reason) ↓ 200 OK 14
(slack) #slack import json
def post_slack(check_name, check_result): message = " :" + check_name + "¥n" message += " :" + check_result + "¥n" print(message) slack_url = "https://hooks.slack.com/services/*****/*****/*****" payload_dic = { "username": " ", "text": message } r = requests.post(slack_url, data=json.dumps(payload_dic)) n.dumps(payload_dic)) 15
16
85 85 85 85 85 85 17 )HTTP&$&'+3
6-*#HTTP * .0slack94 )slack 2 /71 Raspberry Pi"!&(%, 94