Comments (5)
It fetches only one page of records(that is limited to 100 records). The api call returns an "offset" to fetch the next page. See the forEach implementation in the JS client: https://github.com/Airtable/airtable.js/blob/master/lib/table.js#L73
from airtable.py.
Is there a way to increase this page limit? I think I might be missing something.
Pardon me, I'm new to this.
Im using this code to return a list of the records on my table, using the 'Name'
field as the keys, and a dict
as a value for each one.
def get_clientlist():
at = airtable.Airtable('appua4wbLWf65hiXG/', 'my_api_key')
clients = at.get('Clients')['records']
client_list = {}
for item in clients:
name = item['fields']['Name']
client_list[name] = item['fields']
return client_list
from airtable.py.
As @syrnick suggested, you could do something like using offset:
def get_clientlist():
at = airtable.Airtable('appua4wbLWf65hiXG/', 'my_api_key')
client_list = []
clients = at.get('Clients')
offset = clients.get('offset')
client_list.append(clients['records'])
while offset:
clients = at.get('Clients', offset=offset)
offset = client.get('offset')
client_list.append(clients['records'])
return client_list
You could also do everything in a while loop, problem being that offset must be a string with this version.
from airtable.py.
Thanks a ton, guys. I got it working now.
Sorry for the late reply.
And since this isn't technically an 'issue', I'll close it.
from airtable.py.
@MikeVaughanG how did you print out client_list
? Using your code above, I added two lines at the bottom:
from airtable.airtable import Airtable
from airtable import airtable
import requests
def get_clientlist():
at = airtable.Airtable('BASE ID', 'API KEY')
client_list = []
clients = at.get('Project%20Tracker')
offset = clients.get('offset')
client_list.append(clients['records'])
while offset:
clients = at.get('Project%20Tracker', offset=offset)
offset = client.get('offset')
client_list.append(clients['records'])
return client_list
a = get_clientlist()
print a
However, I'm getting the following error:
File "airtable_test.py", line 22, in <module>
a = get_clientlist()
File "airtable_test.py", line 17, in get_clientlist
clients = at.get('Project%20Tracker', offset=offset)
File "/usr/local/lib/python2.7/site-packages/airtable/airtable.py", line 76, in get
if offset and check_string(offset):
File "/usr/local/lib/python2.7/site-packages/airtable/airtable.py", line 31, in check_string
raise IsNotString('Expected a string')
airtable.airtable.IsNotString: Expected a string```
from airtable.py.
Related Issues (20)
- Add support for searching
- Submit to PyPI HOT 2
- no module Airtable HOT 8
- dyld: lazy symbol binding failed
- isinstance(s, str) in iteration fails as n is unicode
- Update image issue HOT 1
- airtable can not interpret Collections.OrderedDict HOT 5
- Is there any command to sort the results? HOT 1
- ModuleNotFoundError HOT 4
- code error : "from .params import AirtablePar"
- [0.4.0] Regression in iterate
- Only one field is not supported in get HOT 1
- Support for typecast HOT 1
- Early heads up: switching away from user API keys HOT 3
- Accelerated need to limit large url requests to “list records”, with alternative POST version
- Format of data to be created in a record not provided appropriately
- is library out of work? HOT 10
- Airtable client's get method does not work for me
- Maybe Add generators to your code
- how to install this module
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from airtable.py.