Update api.py

For 2.0 version you should at least change this line