Skip to main content

Export metadata from the Isogeo REST API into Microsoft Word documents (.docx).

Project description

Isogeo - DOCX Exporter

PyPI PyPI - Python Version

Build Status Azure DevOps coverage

Documentation Status Code style: black

Python package to export Isogeo metadata into Word documents using the Python SDK and docxtpl.

Usage in a nutshell

  1. Install:

    pip install isogeo-export-docx
  2. Authenticate

    # import
    from isogeo_pysdk import Isogeo
    # API client
    isogeo = Isogeo(
    # getting a token
  3. Make a search:

    search ="all",)
    # close session
  4. Export:

    # import
    from isogeotodocx import Isogeo2docx
    # output folder
    # template
    template_path = Path(r"tests\fixtures\template_Isogeo.docx")
    # instanciate
    toDocx = Isogeo2docx()
    # parse results and export it
    for md in search_results.results:
        # load metadata as object
        metadata = Metadata.clean_attributes(md)
        # prepare the template
        tpl = DocxTemplate(template_path.resolve())
        # fill the template
        toDocx.md2docx(docx_template=tpl, md=metadata)
        # filename
        md_name = metadata.title_or_name(slugged=1)
        uuid = "{}".format(metadata._id[:5])
        out_docx_filename = "_output/{}_{}.docx".format(md_name, uuid)
        # save it
        # delete template object
        del tpl

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

isogeo-export-docx-1.1.3.tar.gz (10.5 kB view hashes)

Uploaded source

Built Distribution

isogeo_export_docx-1.1.3-py3-none-any.whl (14.6 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page