Skip to content

Commit

Permalink
Add Python requests example
Browse files Browse the repository at this point in the history
  • Loading branch information
mewim committed Mar 12, 2024
1 parent f281677 commit b04d5f0
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@ For example:

```bash
podman run -p 8000:8000 \
-v /absolute/path/to/database:/database:U \
-v path/to/database:/database:U \
--rm kuzudb/api-server:latest
```

or,

```bash
podman run -p 8000:8000 \
-v /absolute/path/to/database:/database \
-v path/to/database:/database \
--userns=keep-id \
--rm kuzudb/api-server:latest
```
Expand Down Expand Up @@ -120,6 +120,14 @@ With `curl` in the terminal:
curl http://localhost:8000
```

With `request` in Python:

```python
import requests
response = requests.get("http://localhost:8000")
print(response.json())
```

#### Example response:

```json
Expand Down Expand Up @@ -150,6 +158,14 @@ With `curl` in the terminal:
curl http://localhost:8000/schema
```

With `request` in Python:

```python
import requests
response = requests.get("http://localhost:8000/schema")
print(response.json())
```

#### Example response:

```json
Expand Down Expand Up @@ -248,6 +264,19 @@ curl -X POST\
http://localhost:8000/cypher
```

With `request` in Python:

```python
import requests
response = requests.post("http://localhost:8000/cypher", \
json={
"query": "MATCH (u:User) WHERE u.age > $a RETURN u",
"params": {"a": 25}
}
)
print(response.json())
```

#### Example response:

```json
Expand Down

0 comments on commit b04d5f0

Please sign in to comment.