Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any python libs for parsing apache config files?

Any python libs for parsing apache config files or if not python anyone aware of such thing in other languages (perl, php, java, c#)? As i'll be able to rewrite them in python.

like image 297
daniels Avatar asked Oct 25 '08 23:10

daniels


4 Answers

I did find an interesting Apache Config parser for python here: http://www.poldylicious.de/node/25

The Apache Config Parser mentioned is not documented, but it does work.

like image 179
Nick Wilkens Avatar answered Sep 22 '22 02:09

Nick Wilkens


Red Hat's Emerging Technologies group has Augeas (written in C, but with Python bindings available), a generic system configuration tool with "lenses" for reading and writing several different configuration file formats. I would consider investigating the availability of a lens for Apache.

like image 36
Charles Duffy Avatar answered Oct 26 '22 03:10

Charles Duffy


There is a new library as of 2016 written using pyparsing:

https://pypi.python.org/pypi/parse_apache_configs/

Has a few rough edges, but allowed me to add in directives and save to a new file.

Source at https://github.com/alextricity25/parse_apache_configs

like image 3
geographika Avatar answered Oct 26 '22 04:10

geographika


No Python libraries exist that I know of, but here's a perl one: http://packages.debian.org/sid/libapache-configfile-perl

Package: libapache-configfile-perl
Priority: optional
Section: interpreters
Installed-Size: 124
Maintainer: Michael Alan Dorman
Version: 1.18-1
Depends: perl (>= 5.6.0-16)
Description: Parse an Apache style httpd.conf configuration file

This module parses the Apache httpd.conf, or any
compatible config file, and provides methods for
you to access the values from the config file.

If you do rewrite it in Python, please update your post to mention the name of your package on PyPI! :)

like image 1
Michael Gundlach Avatar answered Oct 26 '22 05:10

Michael Gundlach