Skip to main content

Provides method for dynamically injecting variables into a document and/or HTML like object

Project description

Document argument injector

Provides a simple helper method

Argument(s):

  • document (str) the document loaded as a string
  • params (dict) key,value == match,replacement
  • encapsulation (tuple) variable encapsulation ('leftisde', 'rightside')

Returns the provided document with injected parameters

Usage

from injector import injector

document: str
with open('profile.html', 'r') as file:
    document = file.read()

payload: dict = {
    'user.firstName': 'John',
    'user.lastName': 'Smith',
    'user.email': 'jsmith@example.com',
    'user.phone': '+555111444'
    'user.postcode': '1234 Town',
    'user.address': '12 Street'
}

injector(
    document=document,
    params=params,
    encapsulation=('{', '}')
)

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

document-variable-injector-0.1.2.tar.gz (14.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

document_variable_injector-0.1.2-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file document-variable-injector-0.1.2.tar.gz.

File metadata

  • Download URL: document-variable-injector-0.1.2.tar.gz
  • Upload date:
  • Size: 14.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.8.2 Linux/5.4.0-7625-generic

File hashes

Hashes for document-variable-injector-0.1.2.tar.gz
Algorithm Hash digest
SHA256 26de880dccca0a4a6cb9c1487941d7c6341a9cd5212dcdebff254e903b21df84
MD5 06e7bc7cf7d50857ef6c8716300eb0a6
BLAKE2b-256 be17e4cce240dc83e80cbb944ccb90edeb562a457727e2cf550303cf19a07535

See more details on using hashes here.

File details

Details for the file document_variable_injector-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for document_variable_injector-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 590bcc54854318e50bf0ae43095c6ca0c52ccecab6dc7d1e15c838f781ed9fcb
MD5 e7607a00cd4862111a97072396245ed5
BLAKE2b-256 b17dfd370ae9efdcb34e5d916d0cb4fc9903729034658260eaa40b65e63e386d

See more details on using hashes here.

Supported by

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