Code
Below are live code tabs for Python, Go, and Node.js. Tabs are named by language, with syntax highlighting in light and dark themes, and line numbers.
Client snippet (simple request)
- Python
- Go
- Node.js
python.py
import requests
resp = requests.get('https://api.example.com/health')
print(resp.status_code)
main.go
package main
import (
"fmt"
"net/http"
)
func main() {
resp, err := http.Get("https://api.example.com/health")
if err != nil {
panic(err)
}
fmt.Println(resp.StatusCode)
}
index.js
async function main() {
const resp = await fetch('https://api.example.com/health')
console.log(resp.status)
}
main()
SDK: Initialize client
- Python
- Go
- Node.js
client.py
from sdk import Client
client = Client(base_url='https://api.example.com')
client.go
package main
import "example.com/sdk"
func main() {
client := sdk.NewClient("https://api.example.com")
_ = client
}
client.js
import { Client } from '@example/sdk'
const client = new Client({ baseUrl: 'https://api.example.com' })