quickbase-api 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,160 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # poetry
98
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102
+ #poetry.lock
103
+
104
+ # pdm
105
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106
+ #pdm.lock
107
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108
+ # in version control.
109
+ # https://pdm.fming.dev/#use-with-ide
110
+ .pdm.toml
111
+
112
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
113
+ __pypackages__/
114
+
115
+ # Celery stuff
116
+ celerybeat-schedule
117
+ celerybeat.pid
118
+
119
+ # SageMath parsed files
120
+ *.sage.py
121
+
122
+ # Environments
123
+ .env
124
+ .venv
125
+ env/
126
+ venv/
127
+ ENV/
128
+ env.bak/
129
+ venv.bak/
130
+
131
+ # Spyder project settings
132
+ .spyderproject
133
+ .spyproject
134
+
135
+ # Rope project settings
136
+ .ropeproject
137
+
138
+ # mkdocs documentation
139
+ /site
140
+
141
+ # mypy
142
+ .mypy_cache/
143
+ .dmypy.json
144
+ dmypy.json
145
+
146
+ # Pyre type checker
147
+ .pyre/
148
+
149
+ # pytype static type analyzer
150
+ .pytype/
151
+
152
+ # Cython debug symbols
153
+ cython_debug/
154
+
155
+ # PyCharm
156
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
157
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
158
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
159
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
160
+ #.idea/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Tyler Brezler
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,265 @@
1
+ Metadata-Version: 2.4
2
+ Name: quickbase-api
3
+ Version: 0.1.0
4
+ Summary: A simple Python wrapper for the Quickbase API
5
+ Project-URL: Homepage, https://github.com/tbrezler/quickbase-api
6
+ Project-URL: Issues, https://github.com/tbrezler/quickbase-api/issues
7
+ Project-URL: Documentation, https://github.com/tbrezler/quickbase-api#readme
8
+ Author-email: Tyler Brezler <tbrezler@gmail.com>
9
+ License: MIT
10
+ License-File: LICENSE.txt
11
+ Keywords: api,database,quickbase,rest,wrapper
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Requires-Python: >=3.9
24
+ Requires-Dist: requests>=2.25.0
25
+ Provides-Extra: dev
26
+ Requires-Dist: pytest>=7.0; extra == 'dev'
27
+ Requires-Dist: responses>=0.20; extra == 'dev'
28
+ Requires-Dist: ruff; extra == 'dev'
29
+ Description-Content-Type: text/markdown
30
+
31
+ # quickbase-api
32
+
33
+ A simple Python wrapper for the [Quickbase API](https://developer.quickbase.com/).
34
+
35
+ [![PyPI version](https://badge.fury.io/py/quickbase-api.svg)](https://pypi.org/project/quickbase-api/)
36
+ [![Python versions](https://img.shields.io/pypi/pyversions/quickbase-api.svg)](https://pypi.org/project/quickbase-api/)
37
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
38
+
39
+ ## Installation
40
+
41
+ ```bash
42
+ pip install quickbase-api
43
+ ```
44
+
45
+ ## Quick Start
46
+
47
+ ```python
48
+ import quickbase_api
49
+
50
+ # Option 1: Pass credentials directly
51
+ client = quickbase_api.client(
52
+ realm="mycompany.quickbase.com",
53
+ user_token="your-user-token",
54
+ )
55
+
56
+ # Option 2: Use environment variables
57
+ # export QUICKBASE_REALM=mycompany.quickbase.com
58
+ # export QUICKBASE_USER_TOKEN=your-user-token
59
+ client = quickbase_api.client()
60
+
61
+ # Query records from a table
62
+ records = client.query_for_data(
63
+ table_id="bqrg4xyza",
64
+ select=[3, 6, 7],
65
+ where="{6.EX.'Active'}",
66
+ )
67
+ ```
68
+
69
+ ## Authentication
70
+
71
+ This library uses [Quickbase user tokens](https://developer.quickbase.com/auth) for
72
+ authentication. You can pass your credentials directly or set environment variables:
73
+
74
+ | Environment Variable | Description |
75
+ |--------------------------|--------------------------------------------------------|
76
+ | `QUICKBASE_REALM` | Your Quickbase realm (e.g., `mycompany.quickbase.com`) |
77
+ | `QUICKBASE_USER_TOKEN` | Your Quickbase user token |
78
+
79
+ > **Security note:** Never commit tokens to source control. Use environment variables
80
+ > or a secrets manager.
81
+
82
+ ## Usage
83
+
84
+ ### Apps
85
+
86
+ ```python
87
+ # Create an app
88
+ app_id = client.create_app(
89
+ name="My App",
90
+ description="An example app",
91
+ assign_token=True,
92
+ )
93
+
94
+ # Get app metadata
95
+ app = client.get_app(app_id)
96
+
97
+ # Delete an app
98
+ client.delete_app("My App", app_id)
99
+ ```
100
+
101
+ ### Tables
102
+
103
+ ```python
104
+ # Create a table
105
+ table_id = client.create_table(app_id, {
106
+ "name": "Customers",
107
+ "description": "Customer records",
108
+ })
109
+
110
+ # List all tables in an app
111
+ tables = client.get_tables(app_id)
112
+
113
+ # Find a table ID by name
114
+ table_id = client.get_table_id(app_id, "Customers")
115
+
116
+ # Delete a table
117
+ client.delete_table(app_id, table_id)
118
+ ```
119
+
120
+ ### Fields
121
+
122
+ ```python
123
+ # Create a field
124
+ client.create_field(table_id, {
125
+ "label": "Full Name",
126
+ "fieldType": "text",
127
+ })
128
+
129
+ # Create multiple fields at once
130
+ results = client.create_fields(table_id, [
131
+ {"label": "Email", "fieldType": "email"},
132
+ {"label": "Age", "fieldType": "numeric"},
133
+ {"label": "Active", "fieldType": "checkbox"},
134
+ ])
135
+ print(f"Created: {len(results['succeeded'])}, Failed: {len(results['failed'])}")
136
+
137
+ # List all fields in a table
138
+ fields = client.get_table_fields(table_id)
139
+
140
+ # Find a field ID by label
141
+ field_id = client.get_field_id(table_id, "Full Name")
142
+
143
+ # Get a mapping of all field labels to IDs
144
+ field_map = client.get_field_label_id_map(table_id)
145
+ # {"Full Name": "6", "Email": "7", "Age": "8", "Active": "9"}
146
+
147
+ # Set a key field (uses legacy API)
148
+ client.set_key_field(table_id, field_id)
149
+
150
+ # Mark a field as required
151
+ client.set_required_field(table_id, field_id)
152
+ ```
153
+
154
+ ### Records
155
+
156
+ ```python
157
+ # Upsert (insert or update) records
158
+ result = client.upsert_records(table_id, [
159
+ {
160
+ "6": {"value": "Jane Smith"},
161
+ "7": {"value": "jane@example.com"},
162
+ "8": {"value": 32},
163
+ },
164
+ {
165
+ "6": {"value": "Bob Jones"},
166
+ "7": {"value": "bob@example.com"},
167
+ "8": {"value": 45},
168
+ },
169
+ ])
170
+ print(f"Created: {result['created']}, Updated: {result['updated']}")
171
+
172
+ # Check for partial failures
173
+ if result["errored"] > 0:
174
+ print(f"Errors: {result['errored_details']}")
175
+
176
+ # Query for records
177
+ records = client.query_for_data(
178
+ table_id=table_id,
179
+ select=[6, 7, 8],
180
+ where="{8.GT.30}",
181
+ sort_by=[{"fieldId": 6, "order": "ASC"}],
182
+ options={"skip": 0, "top": 100},
183
+ )
184
+
185
+ # Delete records
186
+ deleted = client.delete_records(table_id, where="{8.LT.18}")
187
+ print(f"Deleted {deleted} records")
188
+ ```
189
+
190
+ ### Reports
191
+
192
+ ```python
193
+ # List all reports for a table
194
+ reports = client.get_reports(table_id)
195
+
196
+ # Get a specific report
197
+ report = client.get_report(table_id, report_id="1")
198
+
199
+ # Run a report
200
+ results = client.run_report(table_id, report_id="1", skip=0, top=100)
201
+ ```
202
+
203
+ ## Error Handling
204
+
205
+ The library raises specific exceptions that you can catch and handle:
206
+
207
+ ```python
208
+ from quickbase_api import QuickbaseAPIError, QuickbaseNotFoundError
209
+
210
+ # Handle API errors
211
+ try:
212
+ app = client.get_app("invalid-id")
213
+ except QuickbaseAPIError as e:
214
+ print(f"API error {e.status_code}: {e.response_body}")
215
+
216
+ # Handle not-found lookups
217
+ try:
218
+ table_id = client.get_table_id(app_id, "Nonexistent Table")
219
+ except QuickbaseNotFoundError as e:
220
+ print(f"Not found: {e}")
221
+ ```
222
+
223
+ Exception hierarchy:
224
+
225
+ ```
226
+ QuickbaseError # Base exception
227
+ ├── QuickbaseAPIError # HTTP errors from the API
228
+ └── QuickbaseNotFoundError # Resource not found in lookup methods
229
+ ```
230
+
231
+ ## Logging
232
+
233
+ This library uses Python's built-in `logging` module. To see log output,
234
+ configure logging in your application:
235
+
236
+ ```python
237
+ import logging
238
+
239
+ # See all quickbase-api log messages
240
+ logging.basicConfig(level=logging.INFO)
241
+
242
+ # Or configure just the quickbase_api logger
243
+ logging.getLogger("quickbase_api").setLevel(logging.DEBUG)
244
+ ```
245
+
246
+ ## Configuration
247
+
248
+ ### Retry Behavior
249
+
250
+ The library automatically retries failed requests up to 5 times with
251
+ exponential backoff for the following HTTP status codes:
252
+
253
+ - `429` — Rate limited
254
+ - `502` — Bad gateway
255
+ - `503` — Service unavailable
256
+ - `504` — Gateway timeout
257
+
258
+ ## Requirements
259
+
260
+ - Python 3.9+
261
+ - [requests](https://requests.readthedocs.io/) >= 2.25.0
262
+
263
+ ## License
264
+
265
+ This project is licensed under the MIT License. See [LICENSE](LICENSE) for details.
@@ -0,0 +1,235 @@
1
+ # quickbase-api
2
+
3
+ A simple Python wrapper for the [Quickbase API](https://developer.quickbase.com/).
4
+
5
+ [![PyPI version](https://badge.fury.io/py/quickbase-api.svg)](https://pypi.org/project/quickbase-api/)
6
+ [![Python versions](https://img.shields.io/pypi/pyversions/quickbase-api.svg)](https://pypi.org/project/quickbase-api/)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ pip install quickbase-api
13
+ ```
14
+
15
+ ## Quick Start
16
+
17
+ ```python
18
+ import quickbase_api
19
+
20
+ # Option 1: Pass credentials directly
21
+ client = quickbase_api.client(
22
+ realm="mycompany.quickbase.com",
23
+ user_token="your-user-token",
24
+ )
25
+
26
+ # Option 2: Use environment variables
27
+ # export QUICKBASE_REALM=mycompany.quickbase.com
28
+ # export QUICKBASE_USER_TOKEN=your-user-token
29
+ client = quickbase_api.client()
30
+
31
+ # Query records from a table
32
+ records = client.query_for_data(
33
+ table_id="bqrg4xyza",
34
+ select=[3, 6, 7],
35
+ where="{6.EX.'Active'}",
36
+ )
37
+ ```
38
+
39
+ ## Authentication
40
+
41
+ This library uses [Quickbase user tokens](https://developer.quickbase.com/auth) for
42
+ authentication. You can pass your credentials directly or set environment variables:
43
+
44
+ | Environment Variable | Description |
45
+ |--------------------------|--------------------------------------------------------|
46
+ | `QUICKBASE_REALM` | Your Quickbase realm (e.g., `mycompany.quickbase.com`) |
47
+ | `QUICKBASE_USER_TOKEN` | Your Quickbase user token |
48
+
49
+ > **Security note:** Never commit tokens to source control. Use environment variables
50
+ > or a secrets manager.
51
+
52
+ ## Usage
53
+
54
+ ### Apps
55
+
56
+ ```python
57
+ # Create an app
58
+ app_id = client.create_app(
59
+ name="My App",
60
+ description="An example app",
61
+ assign_token=True,
62
+ )
63
+
64
+ # Get app metadata
65
+ app = client.get_app(app_id)
66
+
67
+ # Delete an app
68
+ client.delete_app("My App", app_id)
69
+ ```
70
+
71
+ ### Tables
72
+
73
+ ```python
74
+ # Create a table
75
+ table_id = client.create_table(app_id, {
76
+ "name": "Customers",
77
+ "description": "Customer records",
78
+ })
79
+
80
+ # List all tables in an app
81
+ tables = client.get_tables(app_id)
82
+
83
+ # Find a table ID by name
84
+ table_id = client.get_table_id(app_id, "Customers")
85
+
86
+ # Delete a table
87
+ client.delete_table(app_id, table_id)
88
+ ```
89
+
90
+ ### Fields
91
+
92
+ ```python
93
+ # Create a field
94
+ client.create_field(table_id, {
95
+ "label": "Full Name",
96
+ "fieldType": "text",
97
+ })
98
+
99
+ # Create multiple fields at once
100
+ results = client.create_fields(table_id, [
101
+ {"label": "Email", "fieldType": "email"},
102
+ {"label": "Age", "fieldType": "numeric"},
103
+ {"label": "Active", "fieldType": "checkbox"},
104
+ ])
105
+ print(f"Created: {len(results['succeeded'])}, Failed: {len(results['failed'])}")
106
+
107
+ # List all fields in a table
108
+ fields = client.get_table_fields(table_id)
109
+
110
+ # Find a field ID by label
111
+ field_id = client.get_field_id(table_id, "Full Name")
112
+
113
+ # Get a mapping of all field labels to IDs
114
+ field_map = client.get_field_label_id_map(table_id)
115
+ # {"Full Name": "6", "Email": "7", "Age": "8", "Active": "9"}
116
+
117
+ # Set a key field (uses legacy API)
118
+ client.set_key_field(table_id, field_id)
119
+
120
+ # Mark a field as required
121
+ client.set_required_field(table_id, field_id)
122
+ ```
123
+
124
+ ### Records
125
+
126
+ ```python
127
+ # Upsert (insert or update) records
128
+ result = client.upsert_records(table_id, [
129
+ {
130
+ "6": {"value": "Jane Smith"},
131
+ "7": {"value": "jane@example.com"},
132
+ "8": {"value": 32},
133
+ },
134
+ {
135
+ "6": {"value": "Bob Jones"},
136
+ "7": {"value": "bob@example.com"},
137
+ "8": {"value": 45},
138
+ },
139
+ ])
140
+ print(f"Created: {result['created']}, Updated: {result['updated']}")
141
+
142
+ # Check for partial failures
143
+ if result["errored"] > 0:
144
+ print(f"Errors: {result['errored_details']}")
145
+
146
+ # Query for records
147
+ records = client.query_for_data(
148
+ table_id=table_id,
149
+ select=[6, 7, 8],
150
+ where="{8.GT.30}",
151
+ sort_by=[{"fieldId": 6, "order": "ASC"}],
152
+ options={"skip": 0, "top": 100},
153
+ )
154
+
155
+ # Delete records
156
+ deleted = client.delete_records(table_id, where="{8.LT.18}")
157
+ print(f"Deleted {deleted} records")
158
+ ```
159
+
160
+ ### Reports
161
+
162
+ ```python
163
+ # List all reports for a table
164
+ reports = client.get_reports(table_id)
165
+
166
+ # Get a specific report
167
+ report = client.get_report(table_id, report_id="1")
168
+
169
+ # Run a report
170
+ results = client.run_report(table_id, report_id="1", skip=0, top=100)
171
+ ```
172
+
173
+ ## Error Handling
174
+
175
+ The library raises specific exceptions that you can catch and handle:
176
+
177
+ ```python
178
+ from quickbase_api import QuickbaseAPIError, QuickbaseNotFoundError
179
+
180
+ # Handle API errors
181
+ try:
182
+ app = client.get_app("invalid-id")
183
+ except QuickbaseAPIError as e:
184
+ print(f"API error {e.status_code}: {e.response_body}")
185
+
186
+ # Handle not-found lookups
187
+ try:
188
+ table_id = client.get_table_id(app_id, "Nonexistent Table")
189
+ except QuickbaseNotFoundError as e:
190
+ print(f"Not found: {e}")
191
+ ```
192
+
193
+ Exception hierarchy:
194
+
195
+ ```
196
+ QuickbaseError # Base exception
197
+ ├── QuickbaseAPIError # HTTP errors from the API
198
+ └── QuickbaseNotFoundError # Resource not found in lookup methods
199
+ ```
200
+
201
+ ## Logging
202
+
203
+ This library uses Python's built-in `logging` module. To see log output,
204
+ configure logging in your application:
205
+
206
+ ```python
207
+ import logging
208
+
209
+ # See all quickbase-api log messages
210
+ logging.basicConfig(level=logging.INFO)
211
+
212
+ # Or configure just the quickbase_api logger
213
+ logging.getLogger("quickbase_api").setLevel(logging.DEBUG)
214
+ ```
215
+
216
+ ## Configuration
217
+
218
+ ### Retry Behavior
219
+
220
+ The library automatically retries failed requests up to 5 times with
221
+ exponential backoff for the following HTTP status codes:
222
+
223
+ - `429` — Rate limited
224
+ - `502` — Bad gateway
225
+ - `503` — Service unavailable
226
+ - `504` — Gateway timeout
227
+
228
+ ## Requirements
229
+
230
+ - Python 3.9+
231
+ - [requests](https://requests.readthedocs.io/) >= 2.25.0
232
+
233
+ ## License
234
+
235
+ This project is licensed under the MIT License. See [LICENSE](LICENSE) for details.