GithubHelp home page GithubHelp logo

airtable-python's Introduction

Airtable Python

Python interface to the Airtable's REST API - https://airtable.com - Build Status

Installation

Airtable Python uses the requests: make sure you have it installed by running

$ pip install requests

Getting started

Once you have created a new base and a new table through the Web interface, you're ready to start using Airtable Python.

import airtable
at = airtable.Airtable('BASE_ID', 'API_KEY')
at.get('TABLE_NAME')

Here's an example of response from the Restaurant's example base

{u'records': [
  {u'fields': {u'Diet': u'Kosher or Halal',
    u'Friendly Restaurants': [u'recr0ITqq9C1I92FL', u'recGeAJLw0ZkbwdXZ'],
    u'Icon': [{u'filename': u'no-pig.jpg',
      u'id': u'attzKGOBbjndOx0FU',
      u'size': 34006,
      u'thumbnails': {u'large': {u'height': 202,
        u'url': u'https://dl.airtable.com/trmtq3BaRoa0sWnyffWZ_large_no-pig.jpg',
        u'width': 256},
       u'small': {u'height': 36,
        u'url': u'https://dl.airtable.com/yzuRv5CyRs2PVH4fDvCe_small_no-pig.jpg',
        u'width': 46}},
      u'type': u'image/jpeg',
      u'url': u'https://dl.airtable.com/DyGOjAASze6AIkQxFpDv_no-pig.jpg'}],
    u'People': [u'Annie', u'Maryam']},
   u'id': u'rec5sD6mBBd0SaXof'},
   ...

API Reference

The available methods closely mimick the REST API:

Get

Given a table name, fetched one or multiple records.

at.get(table_name, [record_id], [limit], [offset])

where

table_name (required) is a string representing the table name
record_id (optional) is a string, which fetches a specific item by id. If not specified, all items are fetched
limit (optional) is an integer, and it can only be specified if record_id is not present, and limits the number of items fetched
offset is a string representing the record id from which we start the offset

Create

Creates a new entry in a table, and returns the newly created entry with its new ID.

at.create(table_name, data)

where

table_name (required) is a string representing the table name
data (required) is a dictionary containing the fields and the resepective values

Update

Updates some fields in a specific entry in the table. Fields which are not explicitely included will not get updated

at.update(table_name, record_id, data)

where

table_name (required) is a string representing the table name
record_id (required) is a string representing the item to update
data (required) is a dictionary containing the fields (and the resepective values) to be updated

Update All

Like the previous method, but updates all fields, clearing the ones that are not included in the request.

at.update_all(table_name, record_id, data)

Delete

Delete a specific record from the table

at.delete(table_name, record_id)

where

table_name (required) is a string representing the table name
record_id (required) is a string representing the item to update

airtable-python's People

Contributors

nicocanali avatar pcorpet avatar strayduy avatar probably-not avatar jan-san avatar

Watchers

Old Account avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.