Python Baserow client

I recently discovered this awesome Python Baserow API client library and I wanted to share it here. You can use it to easily query your tables via the REST API.

The repository can be found here: https://github.com/NiklasRosenstein/python-baserow-client

The documentation can be found here: python-baserow-client

Install via pip: pip install baserow-client

An example of the possibilities:

from baserow.client import BaserowClient

client = BaserowClient('https://baserow.io', jwt='...')

for db in client.list_all_applications():
    print(db, [t.name for t in db.tables])

for table in client.list_database_tables(13):
    print(table)

is_john_smith = Column('field_281').equal('John Smith')
page = client.list_database_table_rows(45, filter=[is_john_smith])
print(page.results)

client.create_database_table_row(45, {
    'field_281': 'Alice Doe',
    'field_293': 'alice@doe.org',
})
6 Likes

What do you think of my idea @bram ?

Could create an api server in python with this library, that’s amazing. Then I use axios or express in native react and so I have a version of baserow mobile; D

mvc


from baserow.client import BaserowClient

client = BaserowClient('https://baserow.io', jwt='...')

def listAllApplications():
      for db in client.list_all_applications():
        print(db, [t.name for t in db.tables])

def listDatabaseTables(idUser): #id=>13
    for table in client.list_database_tables(idUser):
       print(table)

def pageResults(field, equalName, rowId):#field 'field_281'|equal => John Smith|rowId: 45 
    is_john_smith = Column(field).equal(equalName)
    page = client.list_database_table_rows(rowId, filter=[is_john_smith])
    print(page.results)

def createDatabaseTableRow(idUser, field): # id=> 45
   client.create_database_table_row(idUser, {
      'field_281': field, # field_281: 'Alice Doe'
    })
 

# my api server restfull localhost inspire in github-api
# https://api.baserow.com/<jwt-token>/listAll
# https://api.baserow.com/<jwt-token>/listAllApplications
# https://api.baserow.com/<jwt-token>/listDatabaseTables
# https://api.baserow.com/<jwt-token>/pageResults
# https://api.baserow.com/<jwt-token>/createDatabaseTableRow 
// my api server restfull client in react native/vuejs-native
var listAll = "https://api.baserow.com/<jwt-token>/listAll" // return json(method get)
var listAllApplications =  "https://api.baserow.com/<jwt-token>/listAllApplications"  // return json(method get)
var listDatabaseTables = "https://api.baserow.com/<jwt-token>/listDatabaseTables/idUser"  // return json(method get)
var pageResults = "https://api.baserow.com/<jwt-token>/pageResults/field/equalName/rowId" // return json(method get)
var createDatabaseTableRow = "https://api.baserow.com/<jwt-token>/createDatabaseTableNow/idUser/field"  // return json(method post)

cases


const between =(min, max)=> {  
  return Math.floor(Math.random() * (max - min) + min)
}

createDatabaseTableRow  return json =: { idUser: between(10, 1000) "property": "value" }

references, links

That is something that you can do @anon7289648, but my first question would be why you would want to have a proxy between Baserow and your mobile version of Baserow? Would it not be more efficient to have your mobile version connect directly to the Baserow API?

1 Like

To facilitate the support, the adoption of baserow, I thought of doing something like an sdk - software development kit. I think this library could make this implementation easy.

use cases

  1. The json format is present in many programming languages, as well as the template engine html called mustache.
  2. And if we had a python library that generates the api code in various programming languages, would that make things easier?
  3. In the baserow api part, there are 3 options: python, javascript and it has the curl option.

idea

create baserow api(desktop, mobile or web?) = “create react app”

Recommended Toolchains

references

1 Like

python-baserow-client is great, it needs an update to support workspaces (as of baserow 1.16), I just submitted a PR here: add support for Workspace (baserow 1.16 renamed groups to workspaces) by luc-languagetools · Pull Request #7 · NiklasRosenstein/python-baserow-client · GitHub

1 Like