Skip to content

Instantly share code, notes, and snippets.

View phillipkent's full-sized avatar

Phillip Kent phillipkent

View GitHub Profile
#! /usr/bin/env python
# This program is configured for Python version 2.6/2.7
#
# Copyright (C) Interoute Communications Limited, 2016
#
# The config file should have the form:
# {"api_secret": "ABCDEFe17Pgc5WMs28Jwm3H4Drn9CZa3y2K1RiFj5x9S8TzQo64Yfk0L7GqXp71AdWe3k9E0NzPw56XpHd8n4",
# "api_key": "GHIJKL7H0XeKt25Ygi6ANp89JrWj46Fbo5L0Zfc7PTn1z9D3MwQy28EaBq42Sdk4RJd85SoHc0s6FBw39LyDp",
# "api_url": "https://apiserver.example.com/host/c6142d6b-69d8-4114-9721-a627a76f8cce"}
@phillipkent
phillipkent / convert-docx-to-html.py
Created April 17, 2019 12:27
Python code using the python-docx module to convert a DOCX file to HTML
# Converts a docx file with tables and images to (simple) HTML
# ORIGINAL CODE BY DAVID SSALI AT SOURCE: https://medium.com/@dvdssali/docx-to-html-1374eb6491a1
#
# Requires the Python module 'python-docx' <https://python-docx.readthedocs.io>
#
# Example use:
# >>> s = convert('./SOURCEDIR', 'SAMPLE.docx')
# >>> print(s)
# or
# $ python .\convert-docx-to-html.py > temp.html
@phillipkent
phillipkent / convert-docx.py
Last active November 7, 2023 09:19
Python code using the python-docx module to convert a DOCX file to another DOCX file
# Converts a docx file with tables and images to a new docx file
# The new file is based on a 'stub' document which contains preamble text and styles
#
# Requires the Python module 'python-docx' <https://python-docx.readthedocs.io>
# Written for Python 3
#
# Source documents are taken from the directory 'source' and converted documents are saved
# to the directory 'converted'
#
# Two types of source documents are handled: 'Fiscal Guide' or 'Economics Regime'. Each one