Skip to main content

Tool to handle connection strings

Project description

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

License

MIT. See License File.

Usage examples

Constructing a connection string from scratch:

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

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()
Clave=value;

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

pyconstring-0.3.1.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

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

pyconstring-0.3.1-py2.7.egg (15.1 kB view details)

Uploaded Egg

File details

Details for the file pyconstring-0.3.1.tar.gz.

File metadata

  • Download URL: pyconstring-0.3.1.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pyconstring-0.3.1.tar.gz
Algorithm Hash digest
SHA256 3adf75a708dfc6f987b3cbd31a2eb0b6af93b947a47a5449bf42b086f0d10b12
MD5 824df968cc8436ff0e3440cf49a736ac
BLAKE2b-256 d9dbc897c136405606e98da65902ceb868cf9219c49b26f14e307263a8394881

See more details on using hashes here.

File details

Details for the file pyconstring-0.3.1-py2.7.egg.

File metadata

File hashes

Hashes for pyconstring-0.3.1-py2.7.egg
Algorithm Hash digest
SHA256 611e151a8c96be0c65f436013ae52c8c516c1584192abea96a65a0c71c58f4cb
MD5 b6bf4c94b4d916e5e367f49d0f63577e
BLAKE2b-256 b566c0f08b5b4837322b43cbb0f4b17a7650718c2b13905b0ae3c5986e8827db

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