Nginx configuration Parser
Project description
An nginx configuration parser that uses Pyparsing.
You can parse a nginx configuration file with load or loads method:
>>> from nginxparser_eb import load
>>> load(open("/etc/nginx/sites-enabled/foo.conf"))
[['server'], [
['listen', '80'],
['server_name', 'foo.com'],
['root', '/home/ubuntu/sites/foo/']]]]
Same as other serialization modules also you can export configuration with
>>> from nginxparser_eb import load
>>> load(open("/etc/nginx/sites-enabled/foo.conf"))
[['server'], [
['listen', '80'],
['server_name', 'foo.com'],
['root', '/home/ubuntu/sites/foo/']]]]
Same as other serialization modules also you can export configuration with
>>> from nginxparser_eb import load
>>> load(open("/etc/nginx/sites-enabled/foo.conf"))
[['server'], [
['listen', '80'],
['server_name', 'foo.com'],
['root', '/home/ubuntu/sites/foo/']]]]
Same as other serialization modules also you can export configuration with dump and dumps methods.
>>> from nginxparser_eb import dumps
>>> dumps([['server'], [
['listen', '80'],
['server_name', 'foo.com'],
['root', '/home/ubuntu/sites/foo/']]])
'server {
listen 80;
server_name foo.com;
root /home/ubuntu/sites/foo/;
}'
>>> from nginxparser_eb import dumps
>>> dumps([['server'], [
['listen', '80'],
['server_name', 'foo.com'],
['root', '/home/ubuntu/sites/foo/']]])
'server {
listen 80;
server_name foo.com;
root /home/ubuntu/sites/foo/;
}'
>>> from nginxparser_eb import dumps
>>> dumps([['server'], [
['listen', '80'],
['server_name', 'foo.com'],
['root', '/home/ubuntu/sites/foo/']]])
'server {
listen 80;
server_name foo.com;
root /home/ubuntu/sites/foo/;
}'
Installation
The Nginx parser is now available via pip:
pip install nginxparser_eb
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
nginxparser_eb-0.0.5.tar.gz
(3.6 kB
view hashes)