From 79a08d81452e440395c69f53df1734d9160aa0fc Mon Sep 17 00:00:00 2001 From: Jessy Barrette <30420025+JessyBarrette@users.noreply.github.com> Date: Tue, 22 Oct 2024 16:18:08 -0400 Subject: [PATCH 1/8] remove firebase original url dependancy and refactor some of the code --- .gitignore | 4 +- firebase_to_xml/firebase_to_xml/__main__.py | 63 ++++++------------- .../get_records_from_firebase.py | 10 ++- firebase_to_xml/pyproject.toml | 19 ++++++ 4 files changed, 45 insertions(+), 51 deletions(-) create mode 100644 firebase_to_xml/pyproject.toml diff --git a/.gitignore b/.gitignore index ce230ee1..71bc2d86 100644 --- a/.gitignore +++ b/.gitignore @@ -39,4 +39,6 @@ firebase-debug.log .Rproj.user yarn.lock -.env \ No newline at end of file +.env +firebase_to_xml/build +output diff --git a/firebase_to_xml/firebase_to_xml/__main__.py b/firebase_to_xml/firebase_to_xml/__main__.py index aae5768e..6861a6a4 100644 --- a/firebase_to_xml/firebase_to_xml/__main__.py +++ b/firebase_to_xml/firebase_to_xml/__main__.py @@ -6,23 +6,18 @@ import argparse import traceback from pathlib import Path +import os import yaml from dotenv import load_dotenv from metadata_xml.template_functions import metadata_to_xml +from loguru import logger +from tqdm import tqdm -from firebase_to_xml.get_records_from_firebase import get_records_from_firebase -from firebase_to_xml.record_json_to_yaml import record_json_to_yaml +from get_records_from_firebase import get_records_from_firebase +from record_json_to_yaml import record_json_to_yaml -def parse_status(status: str): - """Return a list version fo their status selection""" - - if "," in status: - return status.split(",") - - return [status] - def get_filename(record): """Creates a filename by combinig the title and UUID """ @@ -63,66 +58,46 @@ def main(): ], ) parser.add_argument("--record_url", required=False) - + parser.add_argument("--database_url", default=os.getenv("DATABASE_URL"), required=False, help="Firebase database URL (default: %(default)s)") args = vars(parser.parse_args()) - region = args["region"] - record_status = parse_status(args["status"]) - record_url = args["record_url"] - - firebase_auth_key_file = args["key"] also_save_yaml = args["yaml"] # get list of records from Firebase record_list = get_records_from_firebase( - region, firebase_auth_key_file, record_url, record_status + args["region"], args["key"], record_url, args["status"].split(','), args["database_url"] ) # translate each record to YAML and then to XML - for record in record_list: + for record in tqdm(record_list, desc="Convert records", unit="record"): # if single record it uses std out, hide info - if not record_url: - print( - "Processing", - f"'{record['title']['en']}'", - f"'{record['title']['fr']}'", - record["identifier"], - record["recordID"], - "\n", - ) - try: record_yaml = record_json_to_yaml(record) organization = record.get("organization", "") - name = record.get("filename") or get_filename(record) - - xml_directory = args["out"] + filename = record.get("filename") or get_filename(record) - xml_directory = "/".join([args["out"], organization]) - - Path(xml_directory).mkdir(parents=True, exist_ok=True) + output_directory = Path(args["out"]) / organization + output_directory.mkdir(parents=True, exist_ok=True) # output yaml if also_save_yaml: - filename = f"{xml_directory}/{name}.yaml" - file = open(filename, "w") - file.write(yaml.dump(record_yaml, allow_unicode=True, sort_keys=False)) + yaml_file = output_directory / f"{filename}.yaml" + yaml_file.write_text(yaml.dump(record_yaml, allow_unicode=True, sort_keys=False), encoding="utf-8") # render xml template and write to file xml = metadata_to_xml(record_yaml) if record_url: - print(xml) - else: - filename = f"{xml_directory}/{name}.xml" - file = open(filename, "w") - file.write(xml) - print("Wrote " + file.name) + logger.info(xml) + continue + + xml_file = output_directory / f"{filename}.xml" + xml_file.write_text(xml, encoding="utf-8") except Exception: - print(traceback.format_exc()) + logger.error(traceback.format_exc()) if __name__ == "__main__": diff --git a/firebase_to_xml/firebase_to_xml/get_records_from_firebase.py b/firebase_to_xml/firebase_to_xml/get_records_from_firebase.py index a11ee807..3aa26a73 100644 --- a/firebase_to_xml/firebase_to_xml/get_records_from_firebase.py +++ b/firebase_to_xml/firebase_to_xml/get_records_from_firebase.py @@ -5,15 +5,13 @@ """ import json -import pprint import sys from google.auth.transport.requests import AuthorizedSession from google.oauth2 import service_account - def get_records_from_firebase( - region, firebase_auth_key_file, record_url, record_status, firebase_auth_key_json=None + region:str, firebase_auth_key_file:str, record_url:str, record_status:list, database_url:str, firebase_auth_key_json:str=None ): """ Returns list of records from firebase for this region, @@ -44,7 +42,7 @@ def get_records_from_firebase( if record_url: response = authed_session.get( - f"https://cioos-metadata-form.firebaseio.com/{record_url}.json" + f"{database_url}{record_url}.json" ) body = json.loads(response.text) records.append(body) @@ -52,12 +50,12 @@ def get_records_from_firebase( else: response = authed_session.get( - f"https://cioos-metadata-form.firebaseio.com/{region}/users.json" + f"{database_url}{region}/users.json" ) body = json.loads(response.text) # Parse response - if not body or type(body) != dict : + if not body or not isinstance(body, dict) : print("Region",region,"not found?") # print(response.content) sys.exit() diff --git a/firebase_to_xml/pyproject.toml b/firebase_to_xml/pyproject.toml new file mode 100644 index 00000000..2262d7ca --- /dev/null +++ b/firebase_to_xml/pyproject.toml @@ -0,0 +1,19 @@ +[project] +name = "firebase-to-xml" +version = "0.1.0" +description = "Python module translates metadata records from Firebase into XML" +readme = "README.md" +requires-python = ">=3.12" +dependencies = [ + "firebase-to-xml", + "google-auth>=2.35.0", + "google-oauth>=1.0.1", + "loguru>=0.7.2", + "metadata-xml", + "python-dotenv>=1.0.1", + "tqdm>=4.66.5", +] + +[tool.uv.sources] +metadata-xml = { git = "https://github.com/cioos-siooc/metadata-xml.git" } +firebase-to-xml = { workspace = true } From 70007f1f9244da6564e3fd310f67d390c76264a6 Mon Sep 17 00:00:00 2001 From: Jessy Barrette <30420025+JessyBarrette@users.noreply.github.com> Date: Wed, 23 Oct 2024 13:03:31 -0400 Subject: [PATCH 2/8] add missing comma to firebase.js --- src/firebase.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/firebase.js b/src/firebase.js index 96019e3b..0e9eb3a6 100644 --- a/src/firebase.js +++ b/src/firebase.js @@ -19,7 +19,7 @@ const prodConfig = { storageBucket: "cioos-metadata-form-8d942.appspot.com", messagingSenderId: "467286137979", appId: "1:467286137979:web:250b09e3db2a56716016de", - measurementId: "G-BEMJG40RHN" + measurementId: "G-BEMJG40RHN", }; const devConfig = { @@ -30,7 +30,7 @@ const devConfig = { storageBucket: "cioos-metadata-form-dev-258dc.appspot.com", messagingSenderId: "141560007794", appId: "1:141560007794:web:861d99b02210ea4d17c6eb", - measurementId: "G-BSKRHNR1EW" + measurementId: "G-BSKRHNR1EW", }; From 25dcf3a9a9ffc1f86362e6b0475838864da505b1 Mon Sep 17 00:00:00 2001 From: Jessy Barrette <30420025+JessyBarrette@users.noreply.github.com> Date: Wed, 23 Oct 2024 13:36:41 -0400 Subject: [PATCH 3/8] update firebase projects to match new ones --- .firebaserc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.firebaserc b/.firebaserc index 7536d832..56c94657 100644 --- a/.firebaserc +++ b/.firebaserc @@ -1,7 +1,7 @@ { "projects": { - "default": "cioos-metadata-form", - "dev": "cioos-metadata-form-dev" + "default": "cioos-metadata-form-8d942", + "dev": "cioos-metadata-form-dev-258dc" }, "targets": {}, "etags": {} From 19ec7bd5f0564abce3d317007293286419ddbbcd Mon Sep 17 00:00:00 2001 From: Jessy Barrette <30420025+JessyBarrette@users.noreply.github.com> Date: Wed, 23 Oct 2024 13:45:46 -0400 Subject: [PATCH 4/8] update projectids --- .../firebase-hosting-delete-channel.yml | 2 +- .../workflows/firebase-hosting-pull-request.yml | 2 +- README.md | 16 ++++++++-------- firebase-functions/.firebaserc | 12 ++++++------ src/firebase.js | 10 +++++----- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/.github/workflows/firebase-hosting-delete-channel.yml b/.github/workflows/firebase-hosting-delete-channel.yml index 948de945..924fd6d3 100644 --- a/.github/workflows/firebase-hosting-delete-channel.yml +++ b/.github/workflows/firebase-hosting-delete-channel.yml @@ -19,5 +19,5 @@ jobs: args: hosting:channel:delete pr${{github.event.number}}-${{steps.get-short-name.outputs.id}} --force env: FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} - PROJECT_ID: cioos-metadata-form-dev + PROJECT_ID: cioos-metadata-form-dev-258dc GITHUB_AUTH: ${{ secrets.ISSUE_CREATOR_PAT }} \ No newline at end of file diff --git a/.github/workflows/firebase-hosting-pull-request.yml b/.github/workflows/firebase-hosting-pull-request.yml index 0b1d48b5..7053ac45 100644 --- a/.github/workflows/firebase-hosting-pull-request.yml +++ b/.github/workflows/firebase-hosting-pull-request.yml @@ -26,7 +26,7 @@ jobs: firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_CIOOS_METADATA_FORM }}' expires: 30d entryPoint: '.' - projectId: cioos-metadata-form-dev + projectId: cioos-metadata-form-dev-258dc env: FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} GMAIL_USER: ${{ secrets.GMAIL_USER }} diff --git a/README.md b/README.md index 470bb5cc..94084ef1 100644 --- a/README.md +++ b/README.md @@ -73,12 +73,12 @@ We use a GitHub Actions workflow named `firebase-deploy` for deploying Firebase ### Deploying to Development Project -To deploy updated Firebase functions to the "cioos-metadata-form-dev" development project, follow these steps: +To deploy updated Firebase functions to the "cioos-metadata-form-dev-258dc" development project, follow these steps: -1. **Ensure your local setup is linked to the correct Firebase project** by using the Firebase CLI to login and select the "cioos-metadata-form-dev" project. +1. **Ensure your local setup is linked to the correct Firebase project** by using the Firebase CLI to login and select the "cioos-metadata-form-dev-258dc" project. ```bash - firebase use cioos-metadata-form-dev + firebase use cioos-metadata-form-dev-258dc ``` 2. **Make necessary changes to your Firebase functions.** @@ -103,7 +103,7 @@ The workflow utilizes the following secrets to create the virtual `.env` file fo - `GITHUB_AUTH` used to push to github pages branch and other github action type stuff - `REACT_APP_DEV_DEPLOYMENT` used to switch between development and production databases. Default False, set to True to use Dev database - `REACT_APP_GOOGLE_CLOUD_API_KEY` found at https://console.cloud.google.com/apis/credentials?project=cioos-metadata-form -- `REACT_APP_GOOGLE_CLOUD_API_KEY_DEV` found at https://console.cloud.google.com/apis/credentials?project=cioos-metadata-form-dev +- `REACT_APP_GOOGLE_CLOUD_API_KEY_DEV` found at https://console.cloud.google.com/apis/credentials?project=cioos-metadata-form-dev-258dc ### Using Parameterized Configuration in Firebase Functions @@ -137,12 +137,12 @@ Deploying Firebase Realtime Database security rules via the Firebase CLI is reco ### Define targets -This project has two databases: `cioos-metadata-form` (this is the default/main db for production) and `cioos-metadata-form-dev` (dev). +This project has two databases: `cioos-metadata-form` (this is the default/main db for production) and `cioos-metadata-form-dev-258dc` (dev). Use Firebase CLI targets to manage rules deployment: ```bash firebase target:apply database prod cioos-metadata-form -firebase target:apply database dev cioos-metadata-form-dev +firebase target:apply database dev cioos-metadata-form-dev-258dc ``` ### Configure firebase.json @@ -188,10 +188,10 @@ When hosting the application in a new place there are a couple of things to upda - You must add your new domain to the allowed list for authenication in firebase. https://console.firebase.google.com/u/0/project/cioos-metadata-form/authentication/settings - https://console.firebase.google.com/u/0/project/cioos-metadata-form-dev/authentication/settings + https://console.firebase.google.com/u/0/project/cioos-metadata-form-dev-258dc/authentication/settings - You have to allow your domain under Website restrictions for the firebase browser key https://console.cloud.google.com/apis/credentials/key/405d637a-efd4-48f5-95c6-f0af1d7f4889?project=cioos-metadata-form - https://console.cloud.google.com/apis/credentials/key/23d360a3-4b55-43f2-bc1c-b485371c0e07?project=cioos-metadata-form-dev + https://console.cloud.google.com/apis/credentials/key/23d360a3-4b55-43f2-bc1c-b485371c0e07?project=cioos-metadata-form-dev-258dc \ No newline at end of file diff --git a/firebase-functions/.firebaserc b/firebase-functions/.firebaserc index 71dcf944..c52d8663 100644 --- a/firebase-functions/.firebaserc +++ b/firebase-functions/.firebaserc @@ -1,26 +1,26 @@ { "projects": { - "default": "cioos-metadata-form", - "dev": "cioos-metadata-form-dev" + "default": "cioos-metadata-form-8d942", + "dev": "cioos-metadata-form-dev-258dc" }, "targets": { "cioos-metadata-form": { "database": { "prod": [ - "cioos-metadata-form" + "cioos-metadata-form-8d942" ], "dev": [ - "cioos-metadata-form-dev" + "cioos-metadata-form-dev-258dc" ] } }, "development": { "database": { "prod": [ - "cioos-metadata-form" + "cioos-metadata-form-8d942" ], "dev": [ - "cioos-metadata-form-dev" + "cioos-metadata-form-dev-258dc" ] } } diff --git a/src/firebase.js b/src/firebase.js index 0e9eb3a6..a6a4c6a5 100644 --- a/src/firebase.js +++ b/src/firebase.js @@ -6,7 +6,7 @@ const deployedOnTestServer = process.env.REACT_APP_DEV_DEPLOYMENT; const prodConfig = { // see https://console.cloud.google.com/apis/credentials?project=cioos-metadata-form - // and https://console.cloud.google.com/apis/credentials?project=cioos-metadata-form-dev + // and https://console.cloud.google.com/apis/credentials?project=cioos-metadata-form-dev-258dc // for api key location which is then stored in a github secret and added to several // github actions to support testing and deployment. // see https://firebase.google.com/docs/projects/api-keys for a discussion of why we @@ -24,10 +24,10 @@ const prodConfig = { const devConfig = { apiKey: process.env.REACT_APP_GOOGLE_CLOUD_API_KEY_DEV, - authDomain: "cioos-metadata-form-dev-258dc.firebaseapp.com", - databaseURL: "https://cioos-metadata-form-dev-258dc-default-rtdb.firebaseio.com", - projectId: "cioos-metadata-form-dev-258dc", - storageBucket: "cioos-metadata-form-dev-258dc.appspot.com", + authDomain: "cioos-metadata-form-dev-258dc-258dc.firebaseapp.com", + databaseURL: "https://cioos-metadata-form-dev-258dc-258dc-default-rtdb.firebaseio.com", + projectId: "cioos-metadata-form-dev-258dc-258dc", + storageBucket: "cioos-metadata-form-dev-258dc-258dc.appspot.com", messagingSenderId: "141560007794", appId: "1:141560007794:web:861d99b02210ea4d17c6eb", measurementId: "G-BSKRHNR1EW", From c81d7f42f13df494edbcb00b833e95b6ea67e6dc Mon Sep 17 00:00:00 2001 From: Jessy Barrette <30420025+JessyBarrette@users.noreply.github.com> Date: Wed, 23 Oct 2024 14:05:38 -0400 Subject: [PATCH 5/8] fix dev firebase config --- src/firebase.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/firebase.js b/src/firebase.js index a6a4c6a5..8a080fcc 100644 --- a/src/firebase.js +++ b/src/firebase.js @@ -24,10 +24,10 @@ const prodConfig = { const devConfig = { apiKey: process.env.REACT_APP_GOOGLE_CLOUD_API_KEY_DEV, - authDomain: "cioos-metadata-form-dev-258dc-258dc.firebaseapp.com", - databaseURL: "https://cioos-metadata-form-dev-258dc-258dc-default-rtdb.firebaseio.com", - projectId: "cioos-metadata-form-dev-258dc-258dc", - storageBucket: "cioos-metadata-form-dev-258dc-258dc.appspot.com", + authDomain: "cioos-metadata-form-dev-258dc.firebaseapp.com", + databaseURL: "https://cioos-metadata-form-dev-258dc-default-rtdb.firebaseio.com", + projectId: "cioos-metadata-form-dev-258dc", + storageBucket: "cioos-metadata-form-dev-258dc.appspot.com", messagingSenderId: "141560007794", appId: "1:141560007794:web:861d99b02210ea4d17c6eb", measurementId: "G-BSKRHNR1EW", From 003d02f87a27b7428e6daa9a984714a7d6a06dde Mon Sep 17 00:00:00 2001 From: Jessy Barrette <30420025+JessyBarrette@users.noreply.github.com> Date: Fri, 1 Nov 2024 13:49:16 -0400 Subject: [PATCH 6/8] set node v20 --- firebase-functions/functions/package-lock.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/firebase-functions/functions/package-lock.json b/firebase-functions/functions/package-lock.json index 0ba06238..dcd69c04 100644 --- a/firebase-functions/functions/package-lock.json +++ b/firebase-functions/functions/package-lock.json @@ -18,7 +18,7 @@ "firebase-functions-test": "^0.2.0" }, "engines": { - "node": "14" + "node": "20" } }, "node_modules/@babel/parser": { From 81ef781b6b1292831d52983c6d0ffb3b127e5593 Mon Sep 17 00:00:00 2001 From: Jessy Barrette <30420025+JessyBarrette@users.noreply.github.com> Date: Fri, 1 Nov 2024 13:50:03 -0400 Subject: [PATCH 7/8] add .env.* and *.logs to gitgnore --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 71bc2d86..66cbf978 100644 --- a/.gitignore +++ b/.gitignore @@ -40,5 +40,9 @@ firebase-debug.log yarn.lock .env +.env.* firebase_to_xml/build output + + +*.log From f20bae7f402c54decbefdcfe5e24ea34f291940d Mon Sep 17 00:00:00 2001 From: Jessy Barrette <30420025+JessyBarrette@users.noreply.github.com> Date: Fri, 1 Nov 2024 14:03:11 -0400 Subject: [PATCH 8/8] Revert "remove firebase original url dependancy and refactor some of the code" This reverts commit 79a08d81452e440395c69f53df1734d9160aa0fc. --- .gitignore | 6 +- firebase_to_xml/firebase_to_xml/__main__.py | 63 +++++++++++++------ .../get_records_from_firebase.py | 10 +-- firebase_to_xml/pyproject.toml | 19 ------ 4 files changed, 51 insertions(+), 47 deletions(-) delete mode 100644 firebase_to_xml/pyproject.toml diff --git a/.gitignore b/.gitignore index 66cbf978..a230e760 100644 --- a/.gitignore +++ b/.gitignore @@ -41,8 +41,4 @@ firebase-debug.log yarn.lock .env .env.* -firebase_to_xml/build -output - - -*.log +*.log \ No newline at end of file diff --git a/firebase_to_xml/firebase_to_xml/__main__.py b/firebase_to_xml/firebase_to_xml/__main__.py index 6861a6a4..aae5768e 100644 --- a/firebase_to_xml/firebase_to_xml/__main__.py +++ b/firebase_to_xml/firebase_to_xml/__main__.py @@ -6,18 +6,23 @@ import argparse import traceback from pathlib import Path -import os import yaml from dotenv import load_dotenv from metadata_xml.template_functions import metadata_to_xml -from loguru import logger -from tqdm import tqdm -from get_records_from_firebase import get_records_from_firebase -from record_json_to_yaml import record_json_to_yaml +from firebase_to_xml.get_records_from_firebase import get_records_from_firebase +from firebase_to_xml.record_json_to_yaml import record_json_to_yaml +def parse_status(status: str): + """Return a list version fo their status selection""" + + if "," in status: + return status.split(",") + + return [status] + def get_filename(record): """Creates a filename by combinig the title and UUID """ @@ -58,46 +63,66 @@ def main(): ], ) parser.add_argument("--record_url", required=False) - parser.add_argument("--database_url", default=os.getenv("DATABASE_URL"), required=False, help="Firebase database URL (default: %(default)s)") + args = vars(parser.parse_args()) + region = args["region"] + record_status = parse_status(args["status"]) + record_url = args["record_url"] + + firebase_auth_key_file = args["key"] also_save_yaml = args["yaml"] # get list of records from Firebase record_list = get_records_from_firebase( - args["region"], args["key"], record_url, args["status"].split(','), args["database_url"] + region, firebase_auth_key_file, record_url, record_status ) # translate each record to YAML and then to XML - for record in tqdm(record_list, desc="Convert records", unit="record"): + for record in record_list: # if single record it uses std out, hide info + if not record_url: + print( + "Processing", + f"'{record['title']['en']}'", + f"'{record['title']['fr']}'", + record["identifier"], + record["recordID"], + "\n", + ) + try: record_yaml = record_json_to_yaml(record) organization = record.get("organization", "") - filename = record.get("filename") or get_filename(record) + name = record.get("filename") or get_filename(record) + + xml_directory = args["out"] - output_directory = Path(args["out"]) / organization - output_directory.mkdir(parents=True, exist_ok=True) + xml_directory = "/".join([args["out"], organization]) + + Path(xml_directory).mkdir(parents=True, exist_ok=True) # output yaml if also_save_yaml: - yaml_file = output_directory / f"{filename}.yaml" - yaml_file.write_text(yaml.dump(record_yaml, allow_unicode=True, sort_keys=False), encoding="utf-8") + filename = f"{xml_directory}/{name}.yaml" + file = open(filename, "w") + file.write(yaml.dump(record_yaml, allow_unicode=True, sort_keys=False)) # render xml template and write to file xml = metadata_to_xml(record_yaml) if record_url: - logger.info(xml) - continue - - xml_file = output_directory / f"{filename}.xml" - xml_file.write_text(xml, encoding="utf-8") + print(xml) + else: + filename = f"{xml_directory}/{name}.xml" + file = open(filename, "w") + file.write(xml) + print("Wrote " + file.name) except Exception: - logger.error(traceback.format_exc()) + print(traceback.format_exc()) if __name__ == "__main__": diff --git a/firebase_to_xml/firebase_to_xml/get_records_from_firebase.py b/firebase_to_xml/firebase_to_xml/get_records_from_firebase.py index 3aa26a73..a11ee807 100644 --- a/firebase_to_xml/firebase_to_xml/get_records_from_firebase.py +++ b/firebase_to_xml/firebase_to_xml/get_records_from_firebase.py @@ -5,13 +5,15 @@ """ import json +import pprint import sys from google.auth.transport.requests import AuthorizedSession from google.oauth2 import service_account + def get_records_from_firebase( - region:str, firebase_auth_key_file:str, record_url:str, record_status:list, database_url:str, firebase_auth_key_json:str=None + region, firebase_auth_key_file, record_url, record_status, firebase_auth_key_json=None ): """ Returns list of records from firebase for this region, @@ -42,7 +44,7 @@ def get_records_from_firebase( if record_url: response = authed_session.get( - f"{database_url}{record_url}.json" + f"https://cioos-metadata-form.firebaseio.com/{record_url}.json" ) body = json.loads(response.text) records.append(body) @@ -50,12 +52,12 @@ def get_records_from_firebase( else: response = authed_session.get( - f"{database_url}{region}/users.json" + f"https://cioos-metadata-form.firebaseio.com/{region}/users.json" ) body = json.loads(response.text) # Parse response - if not body or not isinstance(body, dict) : + if not body or type(body) != dict : print("Region",region,"not found?") # print(response.content) sys.exit() diff --git a/firebase_to_xml/pyproject.toml b/firebase_to_xml/pyproject.toml deleted file mode 100644 index 2262d7ca..00000000 --- a/firebase_to_xml/pyproject.toml +++ /dev/null @@ -1,19 +0,0 @@ -[project] -name = "firebase-to-xml" -version = "0.1.0" -description = "Python module translates metadata records from Firebase into XML" -readme = "README.md" -requires-python = ">=3.12" -dependencies = [ - "firebase-to-xml", - "google-auth>=2.35.0", - "google-oauth>=1.0.1", - "loguru>=0.7.2", - "metadata-xml", - "python-dotenv>=1.0.1", - "tqdm>=4.66.5", -] - -[tool.uv.sources] -metadata-xml = { git = "https://github.com/cioos-siooc/metadata-xml.git" } -firebase-to-xml = { workspace = true }