Skip to content

Commit

Permalink
Check return codes not strings.
Browse files Browse the repository at this point in the history
  • Loading branch information
seth-mg committed Feb 11, 2019
1 parent 2ee4456 commit b89c1da
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions examples/docker/run_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,13 @@ function cleanURL() {
}

function validateURL() {
match=$(curl "${ping_url}/ping" -H "X-RosetteAPI-Key: ${API_KEY}" -H "user_key: ${API_KEY}" | grep -o "Rosette API")
if [ "${match}" = "" ]; then
echo -e "\n${ping_url} server not responding\n"
output_file=validate_url_out.log
http_status_code=$(curl -s -o "${output_file}" -w "%{http_code}" -H "X-RosetteAPI-Key: ${API_KEY}" "${ping_url}/ping")
if [ "${http_status_code}" != "200" ]; then
echo -e "\n${ping_url} server not responding. Output is:\n"
cat "${output_file}"
exit 1
fi
fi
}

function runExample() {
Expand Down

0 comments on commit b89c1da

Please sign in to comment.