|
import requests |
|
|
|
|
|
API_KEY = "YOUR_API_KEY" |
|
|
|
|
|
url = "https://api.codepal.ai/v1/cicd-pipeline-writer/query" |
|
|
|
|
|
data = { |
|
"prompt": "Builds a Docker image and deploys it to a Kubernetes cluster using GitHub Actions.", |
|
"pipeline_name": "github-actions" |
|
} |
|
|
|
|
|
headers = { |
|
"Authorization": f"Bearer {API_KEY}" |
|
} |
|
|
|
|
|
response = requests.post(url, headers=headers, data=data) |
|
|
|
|
|
if response.status_code == 201: |
|
pipeline = response.json() |
|
print("Pipeline Generated Successfully:") |
|
print(pipeline["result"]) |
|
else: |
|
print(f"Error: {response.status_code}") |
|
print(response.text) |
|
|