Troubles with Python API