Skip to main content

Simple Apache Config Parser

Welcome to the Simple Apache Config Parser! This package is intended to ease the parsing/analysis of apache config files. This parser uses the Apache Config Lexer provided by the pygments project.

This project is still very much in its infancy, but my focus is on providing easy to use/understand object interfaces to analyze and modify apache config files while attempting to minimize the deltas between the original configs and the modified content. If this software is not quite meeting your needs, drop in an Issue and I'll do my best to address/help, but even if that's failing checkout this other neat parser apacheconfig.

Example usage

Here are some example usages. Note that these examples assume your current working directory properly set to match Include patterns. In the examples below this is for a CentOS installation where the root apache directory tends to be /etc/httpd/.

Parsing

Parsing a config file is easy!

from sacp import *
cf = ConfigFile(file="conf/httpd.conf")

This will automatically parse the httpd.conf from the current directory. Any dependent configs (e.g. those that are listed in an Include or IncludeOptional directive) will also be loaded.

Walking the nodes

Visiting all the nodes is also easy!

from sacp import *

def visit(node):
    print("{}{}".format(node.depth * " ", type(node)))

cf = ConfigFile(file="conf/httpd.conf")
NodeVisitor([cf]).visit(visitor=visit)

This visits all of the nodes in the config file, including it's children, and prints each node type with it's relative depth represented as well.

Contribute

Want to contribute? Awesome! Fork, code, and create a PR.

Metadata

Release files for sacp 0.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sacp 0.7.0
File Size Uploaded Provenance
sacp-0.7.0.tar.gz 6.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for sacp 0.7.0
File Interpreter ABI Platform
sacp-0.7.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.5 kB

Release files / sacp-0.7.0.tar.gz

Download URL sacp-0.7.0.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
34e010f80e446f0921c487273f10a35c7c256f0d6de5a7ae44a876184717bee9
BLAKE2b-256 checksum
How to use checksums
15fcb6efe317fdf59899bc4d6c6eac3d3405a68f942eae5564bd6dc40d5081bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.3.1 pkginfo/1.7.0 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.0

Release files / sacp-0.7.0-py3-none-any.whl

Download URL sacp-0.7.0-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f1b7e44af2493db9c1277806f24c0fcd7c5fcb40b3e4cdfff6dc0ee9988d3f2e
BLAKE2b-256 checksum
How to use checksums
a0f13ebe7e206c1797020817cd89dc9fa8e31732235847e7a3d848654d05dd0f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.3.1 pkginfo/1.7.0 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.0

Security for sacp 0.7.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page