Ignored file cache

This commit is contained in:
Kevin Veen-Birkenbach 2023-09-04 18:46:18 +02:00
parent a1ec0b9760
commit 0dbde23304
4 changed files with 9 additions and 4 deletions

3
.gitignore vendored
View File

@ -1 +1,2 @@
*.json
*.json
__pycache__

View File

@ -40,10 +40,10 @@ class BaserowAPI:
if self.verbose:
print(f"[INFO] Fetching all rows from table with ID: {table_id}...")
rows = []
next_url = f"{self.base_url}database/rows/table/{table_id}/"
next_url = "database/rows/table/{table_id}/"
while next_url:
response = requests.get(next_url, headers=self.headers)
request_response(next_url)
self.print_verbose_message("Requesting:", next_url)
data = self.handle_api_response(response)
if not data:
@ -53,9 +53,12 @@ class BaserowAPI:
return rows
def request_response(self,command):
return requests.get(f"{self.base_url}{command}", headers=self.headers)
def get_all_tables_from_database(self, database_id):
self.print_verbose_message("[INFO] Fetching all tables from database with ID: {database_id}...")
response = requests.get(f"{self.base_url}database/tables/database/{database_id}/", headers=self.headers)
response = request_response("database/tables/database/{database_id}/")
return self.handle_api_response(response) or []
def get_all_data_from_database(self, database_id):

View File

@ -11,6 +11,7 @@ if __name__ == "__main__":
parser.add_argument("--table_ids", help="IDs of the Baserow tables you want to fetch data from, separated by commas.", default=None)
parser.add_argument("--matrix", action="store_true", help="Merge tables based on references.")
parser.add_argument("-v", "--verbose", action="store_true", help="Enable verbose mode for debugging.")
parser.add_argument("--linked_fields", action="store_true", help="Outputs the linked tables")
parser.add_argument("--quiet", action="store_true", help="Suppress output of json")
args = parser.parse_args()