From 0dbde23304b040e3c1080dd3a95e713351dbfd49 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Mon, 4 Sep 2023 18:46:18 +0200 Subject: [PATCH] Ignored file cache --- .gitignore | 3 ++- __pycache__/baserow_api.cpython-311.pyc | Bin 7420 -> 0 bytes baserow_api.py | 9 ++++++--- main.py | 1 + 4 files changed, 9 insertions(+), 4 deletions(-) delete mode 100644 __pycache__/baserow_api.cpython-311.pyc diff --git a/.gitignore b/.gitignore index 94a2dd1..585b27a 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -*.json \ No newline at end of file +*.json +__pycache__ \ No newline at end of file diff --git a/__pycache__/baserow_api.cpython-311.pyc b/__pycache__/baserow_api.cpython-311.pyc deleted file mode 100644 index fa1bda2325655b5893c4d4a231ba6f725ffde37c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7420 zcmb_hU2GFq7M`)k|2H_X35Jl8ArOKCIQ;*Fl;4mA+6GEWOVXxZ;~5eY#||?N(CI`% zRUfPs+NE10vT7^&q3Wh;rDfmxun(x+2OjoeCK@T$NUSQY_MvZHu`4084|~oX|I9d{ z+gp{BY1#%1usya-~;Lx{6GUj0BBGMf&^j)Po-p0%HKM9@!W8_rY=fCL2mf3 zs;;sslf-hGR2Ssfdd>~Gnqn|GV9buh-KPI4@J`N2S<{!A%_OJA_e|eSQM#I!#W-hj zvY5Rld4Y-KL*fS_qXs;r=c)dw{EXN?E#A!JZi-^=YDSs{no3XgUlM2Ya;A`%GNRl+ znJG-oT}`C(Gpn{m4PbP;GS>?E{%R%($|PprGyTbACYLEBlS;HP35i;v2i4gKNQ&esR5R)NJU|9#jLupoe87UktX+pMD}BOz<`P_j`%@P#uEL*| z#8g4#r^J*XN-}>fFY&Mpyd>V36Xk-OP`q#CVbHwNnwp)>X40ubCZFrSF6VP`m)UZ1 zt}q32pwLo|3jrV57I7_D#UICCSqk_DIR%)(EQ<=%COl5;@G-oWKRr=jzJ(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rWys!glZ+@muZhwmo))Z~g1-uf0fEow;Cy~fl*C+Gl;NP@xJpBBg&2OC0P=vz zfCrt3&{<`{y5QCm)*d!br`>(*x*G+Ftb-F*
Oh33JB3XE-(Ec7MVS3-ebGH}P{ zO6)e>82%#ys^@~|!9gLDF2IH3>@nrE%_Yph2t~_P$jN*T4*1oPB?hzkbSf(!OEh}g zKF5K#jIrDuM%y}MJ>R%Xql;@lAA9Jo7g1nK1JEw+mX5+p+KXfx5Esq4jG_stqoOAX*rh@#M`j4L$IX}tiA|+ z!2AI-iObpAya)noZC8I-qp}~l?zX{lxJ<49SDL0jo5@Y%S-uN zS!c`f!*IF#2A+)vB%EEdtu`FXVjvDzww{@}DhdLkq;5NK0Y@V>=uJn;D?vU}-BWob zil~Cwri^84((U1z>B$tt8Ck*@JWi^izlFdg@-<1uS}!XXqB>bKO0CQES{bw5R@2xK zsqsnZ8q8p$ff=NoXwYXy8zZR?RL0w4FxPsrjvE_Z2q0zaPqF69z*YVZZij5a;8A+y zKBAKWgA8b70B*9^ODr1g#MJUcZfPQ?Ps|zm;)#tUYnZ++K*9NApn zcC`4)LQp4LG_s{C!xcD9-iBMfQ9 zi%d3fkPf$ZaidNS803IP4wSX(Y}L$3yrt4W1v8Ni&#C&g6x;EPj(@^2S^$ zYt=|0SbHl7#8WOkph)znvJbOp{?cnm(0y8t6o1~3aATkZKjiyB?$rM(F1M!(7TQ6A z9uNHNQ73D{9=PPJlkSLTZH1|m?LN<8SdSWsgs`?wI((iRxLgey;XSa5D~Y8rstBH+ z2Dup3TFN^I^xQvaP0%svb!dV=s>q{2DsGl#%S`wV{VOw}JM^!@-C$V|xjOv^E&t~W IYN=BH0qQ#WXaE2J diff --git a/baserow_api.py b/baserow_api.py index 842ac20..90b6762 100644 --- a/baserow_api.py +++ b/baserow_api.py @@ -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): diff --git a/main.py b/main.py index 6e322ab..1f54bc4 100644 --- a/main.py +++ b/main.py @@ -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()