diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 601c904..f9da408 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,13 @@ Changelog ========= +0.4.2 +----- +What's Changed +************** + +* add new method to get AT submission metadata by @kflemin in https://github.com/SEED-platform/py-seed/pull/39 + 0.4.1 ----- diff --git a/README.rst b/README.rst index e30b241..377e0d3 100644 --- a/README.rst +++ b/README.rst @@ -1,5 +1,6 @@ py-SEED -======= +=========== + .. image:: https://github.com/seed-platform/py-seed/actions/workflows/ci.yml/badge.svg?branch=develop :target: https://github.com/seed-platform/py-seed/actions/workflows/ci.yml/badge.svg @@ -125,6 +126,7 @@ Full details in LICENSE file. Releasing --------- +* Configure your PyPi with token access `https://pypi.org/manage/account/token/ `_. * Merge down to main * Tag release on GitHub and add in the change log * Release via command line @@ -136,4 +138,4 @@ Releasing pip install twine # make sure to check the dist package for errors in the RST files twine check dist/* - twine upload dist/* + twine upload --repository py-seed dist/* diff --git a/pyseed/seed_client.py b/pyseed/seed_client.py index 15f3e53..b7d175b 100644 --- a/pyseed/seed_client.py +++ b/pyseed/seed_client.py @@ -1427,6 +1427,27 @@ def retrieve_at_building_and_update(self, audit_template_building_id: int, cycle return response + def retrieve_at_submission_metadata(self, audit_template_submission_id: int) -> dict: + """Connect to audit template and retrieve audit report json (metadata only) by submission ID + + Args: + audit_template_submission_id (int): ID of the AT submission report (different than building ID) + + Returns: + dict: Response from the SEED API + """ + + # api/v3/audit_template/pk/get_submission + response = self.client.get( + None, + required_pk=False, + endpoint="audit_template_submission", + url_args={"PK": audit_template_submission_id}, + report_format='json' + ) + + return response + def retrieve_at_submission_and_update(self, audit_template_submission_id: int, cycle_id: int, seed_id: int, report_format: str = 'pdf', filename: str = None) -> dict: """Connect to audit template and retrieve audit report by submission ID @@ -1444,6 +1465,7 @@ def retrieve_at_submission_and_update(self, audit_template_submission_id: int, c # api/v3/audit_template/pk/get_submission # accepts pdf or xml + response = self.client.get( None, required_pk=False, @@ -1454,6 +1476,8 @@ def retrieve_at_submission_and_update(self, audit_template_submission_id: int, c if response['status'] == 'success': if report_format.lower() == 'pdf': + + # for PDF, store pdf report as inventory document pdf_file = response['content'] if not filename: filename = 'at_submission_report_' + str(audit_template_submission_id) + '.pdf' @@ -1470,7 +1494,8 @@ def retrieve_at_submission_and_update(self, audit_template_submission_id: int, c ) response2['pdf_report'] = pdf_file else: - # assume XML + + # assume XML. for XML, update property with BuildingSync # now post to api/v3/properties/PK/update_with_buildingsync xml_file = response['content'] if not filename: diff --git a/setup.cfg b/setup.cfg index 8a18908..1ea6dd7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name=py-seed -version=0.4.1 +version=0.4.2 description=A Python API client for the SEED Platform author=Nicholas Long, Katherine Fleming, Fable Turas, Paul Munday author_email=nicholas.long@nrel.gov, fable@raintechpdx.com, paul@paulmunday.net