# Python Access Datatable

The Python programming language is often used in data science applications. This short example illustrates how to query a Buzzy Datatable from Python.

This example uses two Python libraries [requests](https://www.w3schools.com/python/module_requests.asp) and [json](https://docs.python.org/3/library/json.html).

The flow of the code follows the [microappdata tutorial](/rest-api/buzzy-rest-api/datatabledata-tutorial.md):

* login into buzzy with your credentials
* query all of the microApp rows and print them

```
import requests
import json

credentials = { 
    "email":"my-email@buzzy.buzz",
	"password":"my-password"
}

loginResponse = requests.post("https://a.buzzy.buzz/api/login",data=credentials)
print('Log into Buzzy Server Status',loginResponse.status_code)

if (loginResponse.status_code == 200): 
    print('Log into Buzzy Server Response\n',loginResponse.text)
    rtext = json.loads(loginResponse.text)
    rdata = rtext["data"]
    authToken = rdata["authToken"]
    userId = rdata["userId"]
    print('authToken:', authToken)
    print('userId:', userId)

    headers = {'X-Auth-Token': authToken, 'X-User-Id' : userId }
    mID = {"microAppID" : "insert microapp id here"}

    appResponse = requests.post("https://a.buzzy.buzz/api/microappdata",headers=headers,data=mID)
    rtext = json.loads(appResponse.text)
    body = rtext["body"]
    microAppRows = body["microAppRows"]

    for row in microAppRows:
        print(row)

print("Done.")

```

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.buzzy.buzz/rest-api/buzzy-rest-api/python-access-datatable.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
