chibi-apache


Namechibi-apache JSON
Version 0.0.2 PyPI version JSON
download
home_pagehttps://github.com/dem4ply/chibi_apache
Summarylibreria para leer y escribir los archivos de configuracion de apache
upload_time2023-04-16 03:33:28
maintainer
docs_urlNone
authordem4ply
requires_python
licenseWTFPL
keywords chibi_apache
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            ============
chibi_apache
============


.. image:: https://img.shields.io/pypi/v/chibi_apache.svg
        :target: https://pypi.python.org/pypi/chibi_apache

.. image:: https://img.shields.io/travis/dem4ply/chibi_apache.svg
        :target: https://travis-ci.org/dem4ply/chibi_apache

.. image:: https://readthedocs.org/projects/chibi-apache/badge/?version=latest
        :target: https://chibi-apache.readthedocs.io/en/latest/?badge=latest
        :alt: Documentation Status




libreria para leer y escribir los archivos de configuracion de apache


* Free software: WTFPL
* Documentation: https://chibi-apache.readthedocs.io.


=======
Install
=======


.. code-block:: bash

	pip install chibi-apache


=====
Usage
=====


.. code-block:: bash

	cat > /etc/httpd/conf/httpd.conf << 'endmsg'
	ServerRoot "/etc/httpd"
	Listen 80
	Include conf.modules.d/*.conf
	User apache
	Group apache
	ServerAdmin root@localhost

	<Directory />
		AllowOverride none
		Require all denied
	</Directory>

	<Directory "/var/www">
		AllowOverride None
		Require all granted
	</Directory>

	<Directory "/var/www/html">
		Options Indexes FollowSymLinks
		AllowOverride None
		Require all granted
	</Directory>

	<Directory "/var/www/cgi-bin">
		AllowOverride None
		Options None
		Require all granted
	</Directory>
	DocumentRoot "/var/www/html"

	<IfModule dir_module>
		DirectoryIndex index.html
	</IfModule>

	<IfModule log_config_module>
		LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
		LogFormat "%h %l %u %t \"%r\" %>s %b" common

		<IfModule logio_module>
			LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
		</IfModule>
		CustomLog "logs/access_log" combined
	</IfModule>

	<IfModule alias_module>
		ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
	</IfModule>

	<IfModule mime_module>
		TypesConfig /etc/mime.types
		AddType application/x-compress .Z
		AddType application/x-gzip .gz .tgz
		AddType text/html .shtml
		AddOutputFilter INCLUDES .shtml
	</IfModule>

	<IfModule mime_magic_module>
		MIMEMagicFile conf/magic
	</IfModule>

	<Files ".ht*">
		Require all denied
	</Files>
	ErrorLog "logs/error_log"
	LogLevel warn
	AddDefaultCharset UTF-8
	EnableSendfile on
	IncludeOptional conf.d/*.conf
	endmsg


.. code-block:: python

	from chibi_apache import Chibi_apache

	tmp = Chibi_nginx( '/etc/httpd/conf/httpd.conf' )
	result = tmp.read()
	expected = {
		'AddDefaultCharset': 'UTF-8',
		'Directory': {
			'"/var/www"': {
				'AllowOverride': 'None',
				'Require': 'all granted'
			},
			'"/var/www/cgi-bin"': {
				'AllowOverride': 'None',
				'Options': 'None',
				'Require': 'all granted'
			},
			'"/var/www/html"': {
				'AllowOverride': 'None',
				'Options': 'Indexes FollowSymLinks',
				'Require': 'all granted'
			},
			'/': {
				'AllowOverride': 'none',
				'Require': 'all denied'
			}
		},
		'DocumentRoot': '"/var/www/html"',
		'EnableSendfile': 'on',
		'ErrorLog': '"logs/error_log"',
		'Files': {'".ht*"': {'Require': 'all denied'}},
		'Group': 'apache',
		'IfModule': {
			'alias_module': {
				'ScriptAlias': '/cgi-bin/ "/var/www/cgi-bin/"'
			},
			'dir_module': {
				'DirectoryIndex': 'index.html'
			},
			'log_config_module': {
				'CustomLog': '"logs/access_log" combined',
				'IfModule': {
					'logio_module': {
						'LogFormat': (
							r'"%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" '
							r'\"%{User-Agent}i\" %I %O" combinedio' )
					}
				},
				'LogFormat': [
					( r'"%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" '
						r'\"%{User-Agent}i\"" combined' ),
					r'"%h %l %u %t \"%r\" %>s %b" common'
				]
			},
			'mime_magic_module': {
				'MIMEMagicFile': 'conf/magic'
			},
			'mime_module': {
				'AddOutputFilter': 'INCLUDES .shtml',
				'AddType': [
					'application/x-compress .Z',
					'application/x-gzip .gz .tgz',
					'text/html .shtml'
				],
				'TypesConfig': '/etc/mime.types'
			}
		},
		'Include': 'conf.modules.d/*.conf',
		'IncludeOptional': 'conf.d/*.conf',
		'Listen': '80',
		'LogLevel': 'warn',
		'ServerAdmin': 'root@localhost',
		'ServerRoot': '"/etc/httpd"',
		'User': 'apache'
	}

	assert result == expected

	result.pop( 'User' )
	result.User = 'root'
	tmp.write( result )
	new_result = tmp.read()
	assert new_result.User == 'root'

	result.Directory.pop( '"/var/www/cgi-bin"' )
	tmp.write( result )
	new_result = tmp.read()
	assert '"/var/www/cgi-bin"' not in new_result[ 'Directory' ]


Features
--------

* read and write config files of apache httpd


=======
History
=======

0.0.1 (2023-04-15)
------------------

* First release on PyPI.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/dem4ply/chibi_apache",
    "name": "chibi-apache",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "chibi_apache",
    "author": "dem4ply",
    "author_email": "dem4ply@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/22/a4/4658b7cae355b39033483b33c3df63599174e913011f922a9eb0e3c946d9/chibi_apache-0.0.2.tar.gz",
    "platform": null,
    "description": "============\nchibi_apache\n============\n\n\n.. image:: https://img.shields.io/pypi/v/chibi_apache.svg\n        :target: https://pypi.python.org/pypi/chibi_apache\n\n.. image:: https://img.shields.io/travis/dem4ply/chibi_apache.svg\n        :target: https://travis-ci.org/dem4ply/chibi_apache\n\n.. image:: https://readthedocs.org/projects/chibi-apache/badge/?version=latest\n        :target: https://chibi-apache.readthedocs.io/en/latest/?badge=latest\n        :alt: Documentation Status\n\n\n\n\nlibreria para leer y escribir los archivos de configuracion de apache\n\n\n* Free software: WTFPL\n* Documentation: https://chibi-apache.readthedocs.io.\n\n\n=======\nInstall\n=======\n\n\n.. code-block:: bash\n\n\tpip install chibi-apache\n\n\n=====\nUsage\n=====\n\n\n.. code-block:: bash\n\n\tcat > /etc/httpd/conf/httpd.conf << 'endmsg'\n\tServerRoot \"/etc/httpd\"\n\tListen 80\n\tInclude conf.modules.d/*.conf\n\tUser apache\n\tGroup apache\n\tServerAdmin root@localhost\n\n\t<Directory />\n\t\tAllowOverride none\n\t\tRequire all denied\n\t</Directory>\n\n\t<Directory \"/var/www\">\n\t\tAllowOverride None\n\t\tRequire all granted\n\t</Directory>\n\n\t<Directory \"/var/www/html\">\n\t\tOptions Indexes FollowSymLinks\n\t\tAllowOverride None\n\t\tRequire all granted\n\t</Directory>\n\n\t<Directory \"/var/www/cgi-bin\">\n\t\tAllowOverride None\n\t\tOptions None\n\t\tRequire all granted\n\t</Directory>\n\tDocumentRoot \"/var/www/html\"\n\n\t<IfModule dir_module>\n\t\tDirectoryIndex index.html\n\t</IfModule>\n\n\t<IfModule log_config_module>\n\t\tLogFormat \"%h %l %u %t \\\"%r\\\" %>s %b \\\"%{Referer}i\\\" \\\"%{User-Agent}i\\\"\" combined\n\t\tLogFormat \"%h %l %u %t \\\"%r\\\" %>s %b\" common\n\n\t\t<IfModule logio_module>\n\t\t\tLogFormat \"%h %l %u %t \\\"%r\\\" %>s %b \\\"%{Referer}i\\\" \\\"%{User-Agent}i\\\" %I %O\" combinedio\n\t\t</IfModule>\n\t\tCustomLog \"logs/access_log\" combined\n\t</IfModule>\n\n\t<IfModule alias_module>\n\t\tScriptAlias /cgi-bin/ \"/var/www/cgi-bin/\"\n\t</IfModule>\n\n\t<IfModule mime_module>\n\t\tTypesConfig /etc/mime.types\n\t\tAddType application/x-compress .Z\n\t\tAddType application/x-gzip .gz .tgz\n\t\tAddType text/html .shtml\n\t\tAddOutputFilter INCLUDES .shtml\n\t</IfModule>\n\n\t<IfModule mime_magic_module>\n\t\tMIMEMagicFile conf/magic\n\t</IfModule>\n\n\t<Files \".ht*\">\n\t\tRequire all denied\n\t</Files>\n\tErrorLog \"logs/error_log\"\n\tLogLevel warn\n\tAddDefaultCharset UTF-8\n\tEnableSendfile on\n\tIncludeOptional conf.d/*.conf\n\tendmsg\n\n\n.. code-block:: python\n\n\tfrom chibi_apache import Chibi_apache\n\n\ttmp = Chibi_nginx( '/etc/httpd/conf/httpd.conf' )\n\tresult = tmp.read()\n\texpected = {\n\t\t'AddDefaultCharset': 'UTF-8',\n\t\t'Directory': {\n\t\t\t'\"/var/www\"': {\n\t\t\t\t'AllowOverride': 'None',\n\t\t\t\t'Require': 'all granted'\n\t\t\t},\n\t\t\t'\"/var/www/cgi-bin\"': {\n\t\t\t\t'AllowOverride': 'None',\n\t\t\t\t'Options': 'None',\n\t\t\t\t'Require': 'all granted'\n\t\t\t},\n\t\t\t'\"/var/www/html\"': {\n\t\t\t\t'AllowOverride': 'None',\n\t\t\t\t'Options': 'Indexes FollowSymLinks',\n\t\t\t\t'Require': 'all granted'\n\t\t\t},\n\t\t\t'/': {\n\t\t\t\t'AllowOverride': 'none',\n\t\t\t\t'Require': 'all denied'\n\t\t\t}\n\t\t},\n\t\t'DocumentRoot': '\"/var/www/html\"',\n\t\t'EnableSendfile': 'on',\n\t\t'ErrorLog': '\"logs/error_log\"',\n\t\t'Files': {'\".ht*\"': {'Require': 'all denied'}},\n\t\t'Group': 'apache',\n\t\t'IfModule': {\n\t\t\t'alias_module': {\n\t\t\t\t'ScriptAlias': '/cgi-bin/ \"/var/www/cgi-bin/\"'\n\t\t\t},\n\t\t\t'dir_module': {\n\t\t\t\t'DirectoryIndex': 'index.html'\n\t\t\t},\n\t\t\t'log_config_module': {\n\t\t\t\t'CustomLog': '\"logs/access_log\" combined',\n\t\t\t\t'IfModule': {\n\t\t\t\t\t'logio_module': {\n\t\t\t\t\t\t'LogFormat': (\n\t\t\t\t\t\t\tr'\"%h %l %u %t \\\"%r\\\" %>s %b \\\"%{Referer}i\\\" '\n\t\t\t\t\t\t\tr'\\\"%{User-Agent}i\\\" %I %O\" combinedio' )\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t'LogFormat': [\n\t\t\t\t\t( r'\"%h %l %u %t \\\"%r\\\" %>s %b \\\"%{Referer}i\\\" '\n\t\t\t\t\t\tr'\\\"%{User-Agent}i\\\"\" combined' ),\n\t\t\t\t\tr'\"%h %l %u %t \\\"%r\\\" %>s %b\" common'\n\t\t\t\t]\n\t\t\t},\n\t\t\t'mime_magic_module': {\n\t\t\t\t'MIMEMagicFile': 'conf/magic'\n\t\t\t},\n\t\t\t'mime_module': {\n\t\t\t\t'AddOutputFilter': 'INCLUDES .shtml',\n\t\t\t\t'AddType': [\n\t\t\t\t\t'application/x-compress .Z',\n\t\t\t\t\t'application/x-gzip .gz .tgz',\n\t\t\t\t\t'text/html .shtml'\n\t\t\t\t],\n\t\t\t\t'TypesConfig': '/etc/mime.types'\n\t\t\t}\n\t\t},\n\t\t'Include': 'conf.modules.d/*.conf',\n\t\t'IncludeOptional': 'conf.d/*.conf',\n\t\t'Listen': '80',\n\t\t'LogLevel': 'warn',\n\t\t'ServerAdmin': 'root@localhost',\n\t\t'ServerRoot': '\"/etc/httpd\"',\n\t\t'User': 'apache'\n\t}\n\n\tassert result == expected\n\n\tresult.pop( 'User' )\n\tresult.User = 'root'\n\ttmp.write( result )\n\tnew_result = tmp.read()\n\tassert new_result.User == 'root'\n\n\tresult.Directory.pop( '\"/var/www/cgi-bin\"' )\n\ttmp.write( result )\n\tnew_result = tmp.read()\n\tassert '\"/var/www/cgi-bin\"' not in new_result[ 'Directory' ]\n\n\nFeatures\n--------\n\n* read and write config files of apache httpd\n\n\n=======\nHistory\n=======\n\n0.0.1 (2023-04-15)\n------------------\n\n* First release on PyPI.\n",
    "bugtrack_url": null,
    "license": "WTFPL",
    "summary": "libreria para leer y escribir los archivos de configuracion de apache",
    "version": "0.0.2",
    "split_keywords": [
        "chibi_apache"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "75865c26cd8a5b87df6f10bd7e2e7816cc7e675fe5cc3cee932ae852ea58990c",
                "md5": "bdc4be7dfba733c8b40088a9747597a6",
                "sha256": "580ea57b6be43318dd9cb2fd7d879e980061abfff13e2f0c6d0550a7f00d0450"
            },
            "downloads": -1,
            "filename": "chibi_apache-0.0.2-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "bdc4be7dfba733c8b40088a9747597a6",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 4564,
            "upload_time": "2023-04-16T03:33:26",
            "upload_time_iso_8601": "2023-04-16T03:33:26.462231Z",
            "url": "https://files.pythonhosted.org/packages/75/86/5c26cd8a5b87df6f10bd7e2e7816cc7e675fe5cc3cee932ae852ea58990c/chibi_apache-0.0.2-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "22a44658b7cae355b39033483b33c3df63599174e913011f922a9eb0e3c946d9",
                "md5": "5237e81d071d96ec214a8b1bda331f07",
                "sha256": "ffa355b327c359833ea6612e3118ee20af15977c573de1c42142e94f1c1528a7"
            },
            "downloads": -1,
            "filename": "chibi_apache-0.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "5237e81d071d96ec214a8b1bda331f07",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 11323,
            "upload_time": "2023-04-16T03:33:28",
            "upload_time_iso_8601": "2023-04-16T03:33:28.636850Z",
            "url": "https://files.pythonhosted.org/packages/22/a4/4658b7cae355b39033483b33c3df63599174e913011f922a9eb0e3c946d9/chibi_apache-0.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-16 03:33:28",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "dem4ply",
    "github_project": "chibi_apache",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": false,
    "lcname": "chibi-apache"
}
        
Elapsed time: 0.25545s