7. Biblioteki zewnętrzne

7.1. Inne

7.1.1. Wykonywanie poleceń równolegle na wielu maszynach


7.1.2. Wizualizacja danych

# Install superset
pip install superset

# Create an admin user (you will be prompted to set username, first and last name before setting a password)
fabmanager create-admin --app superset

# Initialize the database
superset db upgrade

# Load some data to play with
superset load_examples

# Create default roles and permissions
superset init

# Start the web server on port 8088, use -p to bind to another port
superset runserver

# To start a development web server, use the -d switch
# superset runserver -d
gunicorn \
    -w 10 \
    -k gevent \
    --timeout 120 \
    -b \
    --limit-request-line 0 \
    --limit-request-field_size 0 \
    --statsd-host localhost:8125 \

7.1.4. Zastosowania sieciowe

7.1.6. Allegro Tipboard

Tipboard is a system for creating dashboards, written in JavaScript and Python. Its widgets (‘tiles’ in Tipboard’s terminology) are completely separated from data sources, which provides great flexibility and relatively high degree of possible customizations.

Because of its intended target (displaying various data and statistics in your office), it is optimized for larger screens.

Similar projects: Geckoboard, Dashing.

$ pip install tipboard
$ tipboard create_project my_test_dashboard
$ tipboard runserver

7.1.7. Allegro Ralph

Ralph is full-featured Asset Management, DCIM and CMDB system for data center and back office.


  • keep track of assets purchases and their life cycle
  • generate flexible and accurate cost reports
  • integrate with change management process using JIRA integration

It is an Open Source project provided on Apache v2.0 License.

Live demo:

7.1.8. ldap3

import datetime
import time
from pprint import pprint
from ldap3 import Server, Connection, SEARCH_SCOPE_WHOLE_SUBTREE

USER = 'myusername'
PASS = 'mypassword'
BASEDN = 'OU=Users,DC=local'
SERVER = Server('', port=389)
ATTRIBUTES = ['mail', 'pwdLastSet']

def construct_filter(wintimestamp):
    return """(&

def search(filter):
    with Connection(SERVER, user=USER, password=PASS) as c:
        c.search(BASEDN, filter, SEARCH_SCOPE_WHOLE_SUBTREE, attributes=ATTRIBUTES)
        return [record['attributes'] for record in c.response]

def datetime_to_mstimestamp(date):
    Active Direcotry has different approach to create timestamp than Unix.
    Here's a function to convert the Unix timestamp to the AD one.

    >>> datetime_to_mstimestamp(datetime.datetime(2000, 1, 1, 0, 0))
    timestamp = int(time.mktime(date.timetuple()))
    magic_number = 116444736000000000
    return timestamp * 10000000 + magic_number

def mstimestamp_to_datetime(mstimestamp):
    Active Direcotry has different approach to create timestamp than Unix.
    Here's a function to convert AD timestamp to the Unix one.

    >>> mstimestamp_to_datetime(130567328471235643)
    datetime.datetime(2014, 10, 2, 16, 14, 7, 123563)
    magic_number = 11644473600
    return datetime.datetime.fromtimestamp(mstimestamp / 10000000 - magic_number)

def month_ago(date):
    >>> month_ago(datetime.datetime(2000, 1, 31, 0, 0))
    datetime.datetime(2000, 1, 1, 0, 0)
    return date - datetime.timedelta(days=30)

def print_users_with_expiring_password():
    now = datetime.datetime.now()
    expiration_date = month_ago(now)
    wintimestamp = datetime_to_mstimestamp(expiration_date)
    older_than_month_ago = construct_filter(wintimestamp)

    for user in search(older_than_month_ago):
        user['pwdLastSet'] = mstimestamp_to_datetime(int(user['pwdLastSet'][0]))

if __name__ == '__main__':