Pymagento provides python bindings for the Magento Core API.
pip install pymagento
import pymagento
api = pymagento.Magento("hostname", "api_user", "api_key")
category_id = api.category.create(1, {"name": "New Category"})
category_info = api.category.info(category_id)
arbitrary_product = api.product.list()[39]
api.category.assignProduct(arbitrary_product["id"])
See magento.com for API documentation.