What web3.py version do you use?
It seems you use web3 >= v6.0.0 where deprecated camelCase methods were removed in favor of snake_case ones while your code has been written for <v6.0.0.
In this case, you should replace:
buildTransaction
with build_transaction
getTransactionCount
with get_transaction_count
Do not change swapExactETHForTokens
though, as it's part of the ABI.