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 (str) 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for document-variable-injector-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c122e2d526a259b9f6aa04981de57373fd37ecd197dca32778e519c34b37b6e |
|
MD5 | 9b83d0840760a20f4fe2262d5c11b9d8 |
|
BLAKE2b-256 | 6b156619aa38ce108be52b546d8d1bd67dab3bcedcbb6790917a6d0e168d13d5 |
Close
Hashes for document_variable_injector-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 67ce12b25d82fc0cc705f2f1a5543b29d63e68538a390e66403f5a83afb980c2 |
|
MD5 | 8b93be182045dc3811e75422573c6cd7 |
|
BLAKE2b-256 | 60b10afe8abd858103d3acacd839a21a963df1f96fa4c50748d2ad249cb5524f |