skip to navigation
skip to content

pyconstring 1.0.0

Tool to handle connection strings

Package Documentation


Tool to handle connection strings. Offers an easy API that parses and constructs connection strings in the form of Key=Value;, as easy as handling a dictionary. Works with both Python 2.7 and 3.x


MIT. See License File.


pyconstring is on PyPI

pip install pyconstring


easy_install pyconstring

Usage examples

Constructing a connection string from scratch:

>>> from pyconstring import ConnectionString
>>> cs = ConnectionString()
>>> cs['user'] = 'manuel'
>>> cs['password'] = '1234'
>>> print cs.get_string()

Parsing an already existing string:

>>> cs = ConnectionString.from_string('key1=value1;key2=value2;')
>>> cs['key1'] = 'another value'
>>> cs.get_string()
u'Key1=another value;Key2=value2;'
>>> cs['user'] = 'johnny'
>>> print cs.get_string()
Key1=another value;Key2=value2;User=johnny;

Automated escaping when necessary:

>>> cs = ConnectionString()
>>> cs['weird=key'] = '" weird;value  '
>>> print cs.get_string()
Weird==Key='" weird;value  ';

Key translation:

>>> cs['key'] = 'value'
>>> cs.translate({'key': 'clave'})
>>> print cs.get_string()

More information in the documentation.

If you find any bug or have any suggestion, feel free to send me an email or open an issue on github.

File Type Py Version Uploaded on Size
pyconstring-1.0.0.tar.gz (md5) Source 2017-09-21 4KB