openai/openai-python

Public

mirrored from https://github.com/openai/openai-pythonAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v1.29.0

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

scripts/mock

41lines · modeblame

d2738d42Stainless Bot2 years ago1#!/usr/bin/env bash
2
3set -e
4
5cd "$(dirname "$0")/.."
6
7if [[ -n "$1" && "$1" != '--'* ]]; then
8URL="$1"
9shift
10else
11URL="$(grep 'openapi_spec_url' .stats.yml | cut -d' ' -f2)"
12fi
13
14# Check if the URL is empty
15if [ -z "$URL" ]; then
16echo "Error: No OpenAPI spec path/url provided or found in .stats.yml"
17exit 1
18fi
19
20echo "==> Starting mock server with URL ${URL}"
21
22# Run prism mock on the given spec
23if [ "$1" == "--daemon" ]; then
aed1e437Stainless Bot2 years ago24npm exec --package=@stoplight/prism-cli@~5.8 -- prism mock "$URL" &> .prism.log &
d2738d42Stainless Bot2 years ago25
26# Wait for server to come online
27echo -n "Waiting for server"
28while ! grep -q "✖ fatal\|Prism is listening" ".prism.log" ; do
29echo -n "."
30sleep 0.1
31done
32
33if grep -q "✖ fatal" ".prism.log"; then
34cat .prism.log
35exit 1
36fi
37
38echo
39else
aed1e437Stainless Bot2 years ago40npm exec --package=@stoplight/prism-cli@~5.8 -- prism mock "$URL"
d2738d42Stainless Bot2 years ago41fi