These are some common questions users have when they are learning the capabilities of our Python API.
What should I do when I hit my API rate limit?
When the user attempts too many requests to the API within a short timeframe, the API will raise an
ApiLimitError exception. Our support engineers recommend that you implement your own retry logic if this happens. However, if you have hit the 500 API calls per limit, consider making less calls to the API.
Can I customize my queue/set prioritization?
Yes. To learn how to customize the order of the data rows in a queue, see
Project.set_labeling_parameter_overrides(self, data) in our API reference. For a detailed explanation of how queue customization works in Labelbox, see Queue customization.
Can I re-enqueue Labels?
This can be done with
Label.bulk_delete(). It will automatically re-enqueue the labels. For instructions on how to do this with the GraphQL API, see Re-enqueue labels programmatically.
How can I sort the Labelbox objects I get from the API?
One-to-many relationship fetches can be sorted by calling a relationship and providing passing a value for
order_by. You can only sort one field at a time in ascending or descending order. Currently, it's not possible to automatically sort top-level collections (such as
Client.get_projects()) in a fetch. The example below fetches and alphabetically sorts in ascending order the datasets from a specified project.
project = client.get_project("<project_id>")
sorted_datasets = project.datasets(order_by=Dataset.name.asc)
If your Python API does not have the method I’m looking for, can I write my own custom GraphQL queries?
You can write your own custom GraphQL queries using
Can I import/remove model-assisted predictions?
A method for adding predictions (in bulk or individually) currently does not exist in version 2.2 of the Python API. This is an upcoming feature. However, you can use
Client.execute() and include a GraphQL query to import predictions. For instructions on how to do this, see Import model prediction.
Can I add users using the Python API? A method for adding users (in bulk or individually) to a project or an organization does not exist in version 2.2 of the Python API.
If you are looking for a particular functionality that has not been mentioned in this page or previous pages in this section, please take a look at our comprehensive Python API reference.
Was this section helpful? Give your feedback below.