LoginSignup
1
0

More than 5 years have passed since last update.

Travis CIでAPIをテストするときは

Posted at

Travis CIでAPIをテストするときには、APIを使うテスト前に「APIが利用できるか」確認しましょう。

# Checks if API is available. This file is in the public domain.
import sys
import requests
api = requests.get("https://api.scratch.mit.edu").status_code
if api>=400:
    print("API not available! Test failed.")
    sys.exit(1)
print("API confirmed.")
sys.exit(0)
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0