document-variable-injector-0.1.2
توضیحات
Provides method for dynamically injecting variables into a document and/or HTML like object
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | document-variable-injector-0.1.2 |
| نام | document-variable-injector |
| نسخه کتابخانه | 0.1.2 |
| نگهدارنده | ['Alex Pedersen'] |
| ایمیل نگهدارنده | ['me@alexpdr.dev'] |
| نویسنده | Alex Pedersen |
| ایمیل نویسنده | me@alexpdr.dev |
| آدرس صفحه اصلی | https://github.com/alexpdr/document-variable-injector |
| آدرس اینترنتی | https://pypi.org/project/document-variable-injector/ |
| مجوز | GPL-3.0-or-later |
# 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
```py
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=('{', '}')
)
```
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.8,<4.0 | Python |
نحوه نصب
نصب پکیج whl document-variable-injector-0.1.2:
pip install document-variable-injector-0.1.2.whl
نصب پکیج tar.gz document-variable-injector-0.1.2:
pip install document-variable-injector-0.1.2.tar.gz