@@ -125,12 +125,13 @@ export function ApiDeploy({
125125 ${ endpoint } `
126126
127127 case 'python' :
128- return `import requests
128+ return `import os
129+ import requests
129130
130131response = requests.post(
131132 "${ endpoint } ",
132133 headers={
133- "X-API-Key": SIM_API_KEY,
134+ "X-API-Key": os.environ.get(" SIM_API_KEY") ,
134135 "Content-Type": "application/json"
135136 },
136137 json=${ JSON . stringify ( payload , null , 4 ) . replace ( / \n / g, '\n ' ) }
@@ -142,7 +143,7 @@ print(response.json())`
142143 return `const response = await fetch("${ endpoint } ", {
143144 method: "POST",
144145 headers: {
145- "X-API-Key": SIM_API_KEY,
146+ "X-API-Key": process.env. SIM_API_KEY,
146147 "Content-Type": "application/json"
147148 },
148149 body: JSON.stringify(${ JSON . stringify ( payload ) } )
@@ -155,7 +156,7 @@ console.log(data);`
155156 return `const response = await fetch("${ endpoint } ", {
156157 method: "POST",
157158 headers: {
158- "X-API-Key": SIM_API_KEY,
159+ "X-API-Key": process.env. SIM_API_KEY,
159160 "Content-Type": "application/json"
160161 },
161162 body: JSON.stringify(${ JSON . stringify ( payload ) } )
@@ -183,12 +184,13 @@ console.log(data);`
183184 ${ endpoint } `
184185
185186 case 'python' :
186- return `import requests
187+ return `import os
188+ import requests
187189
188190response = requests.post(
189191 "${ endpoint } ",
190192 headers={
191- "X-API-Key": SIM_API_KEY,
193+ "X-API-Key": os.environ.get(" SIM_API_KEY") ,
192194 "Content-Type": "application/json"
193195 },
194196 json=${ JSON . stringify ( payload , null , 4 ) . replace ( / \n / g, '\n ' ) } ,
@@ -203,7 +205,7 @@ for line in response.iter_lines():
203205 return `const response = await fetch("${ endpoint } ", {
204206 method: "POST",
205207 headers: {
206- "X-API-Key": SIM_API_KEY,
208+ "X-API-Key": process.env. SIM_API_KEY,
207209 "Content-Type": "application/json"
208210 },
209211 body: JSON.stringify(${ JSON . stringify ( payload ) } )
@@ -222,7 +224,7 @@ while (true) {
222224 return `const response = await fetch("${ endpoint } ", {
223225 method: "POST",
224226 headers: {
225- "X-API-Key": SIM_API_KEY,
227+ "X-API-Key": process.env. SIM_API_KEY,
226228 "Content-Type": "application/json"
227229 },
228230 body: JSON.stringify(${ JSON . stringify ( payload ) } )
@@ -265,7 +267,7 @@ while (true) {
265267response = requests.post(
266268 "${ endpoint } ",
267269 headers={
268- "X-API-Key": SIM_API_KEY,
270+ "X-API-Key": process.env. SIM_API_KEY,
269271 "Content-Type": "application/json",
270272 "X-Execution-Mode": "async"
271273 },
@@ -279,7 +281,7 @@ print(job) # Contains job_id for status checking`
279281 return `const response = await fetch("${ endpoint } ", {
280282 method: "POST",
281283 headers: {
282- "X-API-Key": SIM_API_KEY,
284+ "X-API-Key": process.env. SIM_API_KEY,
283285 "Content-Type": "application/json",
284286 "X-Execution-Mode": "async"
285287 },
@@ -293,7 +295,7 @@ console.log(job); // Contains job_id for status checking`
293295 return `const response = await fetch("${ endpoint } ", {
294296 method: "POST",
295297 headers: {
296- "X-API-Key": SIM_API_KEY,
298+ "X-API-Key": process.env. SIM_API_KEY,
297299 "Content-Type": "application/json",
298300 "X-Execution-Mode": "async"
299301 },
0 commit comments