rsclib

A Python library to help you with your development.
Download

rsclib Ranking & Summary

Advertisement

  • Rating:
  • License:
  • LGPL
  • Publisher Name:
  • Ralf Schlatterbeck
  • File Size:
  • 58 KB

rsclib Tags


rsclib Description

rsclib is a small Python library designed with configuration file parsing, HTML and PDF parsing. The library includes various utility modules used in other projects: · ast_call: A simple call manager using asterisk: This can be used to originate a call and log all event associated to that call. So you can find out the status of the call and optionally the dialstatus. · ast_cdr: parser for CDR records in asterisk. We currently use text-files only, this might be later extended for database use. · Autosuper magic (originally from Guido van Rossums announcement of Python 2.2): For refactoring it's a good idea that each class knows its parents (that the parent is not hardcoded in the upcall), achieved by adding a the __super attribute. Use as, e.g., self.__super.method for calling method in the parent. · bero: A configurator for the bero*fos failover switch. See my blogpost why I wrote that (short summary: to work around bugs in the firmware of the device which are not addressed by the configurator code that comes with the device). · Config_File for python-syntax configuration files used in several of my projects. · execute: module for executing commands and handling IO, this also has a Lock and a Log mixin. Now there is also a framework for executing processes in a pipeline, there can be fork-points in the pipeline where the output of one process feeds several pipelines. See test_exec.py and test2_exec.py. · Firstname: given a string-candidate of a first name, check with popular web-site if it is really considered a first name. · grepmime: search for pattern in email attachments (even if these are encoded) · HTML_Parse for opening and parsing URLs · IP4_Address: IP v4 Addresses with subnet masking · iter_recipes: magic with iterators · lcr: model the status of Linux Call Router ISDN lines. · Math implements Euclids algorithm for greatest common divisor and as a by-product the least common multiple · nmap: A parser for output of nmap scans to (e.g. to generate tables in TeX) · ocf: small framework for writing OCF scripts for the heartbeat cluster resource manager (probably also usable for the newer version called pacemaker but for now only tested with the version in Debian stable aka lenny). · PDF_Parse for opening and parsing PDFs, needs pdftotext installed · PDF_Signature: experimental code for checking signatures on adobe PDF documents · PM_Value: Possibly missing value, encapsulate a number which may be missing and associated arithmetics. · Rational: Implementation of Rational numbers · stateparser: Simple state-machine parser class · timeout: A simple timeout mechanism using SIGALRM · Tex_CSV_Writer: Write CVS files in a syntax that can be parsed by TeX. Implements same interface as the csv module. Only implements writing. · trafficshape: Simple traffic shaping configuration: Currently generates Linux tc commands for a traffic shaping config using hfsc for shaping and sfq or red for the leaf qdiscs. We also provide a translator from iptables mangle rules (for traffic marking) to tc commands for filtering. This is needed if we want to do inbound shaping. The Linux kernel doesn't support inbound shaping, so we need to redirect all traffic to an ifb device. On that device we do outbound shaping. Unfortunately when sending traffic to an ifb device with a tc filter + action mirred command this occurs before the PREROUTING chain. This means packets are not yet marked. So we provide a parser to translate mangle rules in the PREROUTING chain to appropriate tc commands. For implementing this we mark packets (using the tc action ipt for iptables marking) in the original device and then use the marked information in the ifb device to send the traffic to appropriate qdiscs. This supports a two-level approach: Rules in iptables that match on a packet mark (using --mark) are translated to tc commands in the ifb device (they depend on the mark already present). All other rules are translated to a tc action ipt (using -j MARK) and a tc action mirred redirect (for sending the traffic to the ifb device) for the original device (e.g. eth0 redirecting to ifb0). The PREROUTING commands by default are directly taken from the running kernel by default (using "iptables -t mangle -S -v")


rsclib Related Software