Skip to content

Tag: python-3.x

How could I list Azure Virtual Machines using Python?

I’ve used the below code to get the Access Token from my Azure account. https://github.com/AzureAD/azure-activedirectory-library-for-python/blob/dev/sample/certificate_credentials_sample.py It’s working fine, I already got the token. However, how can I use this token to list all VMs running in that subscripti…

NameError: name ‘__file__’ is not defined

I am trying to store the path of a script into a variable using: However, it keeps returning a name ‘__file__’ is not defined error. Answer Pretty sure you are running this in a terminal in the interactive Python as it is the only place (I’m aware of) to not have __file__. Also, if it was a …

What is the alternative of @api.one in Odoo 13?

Right now when I started coding on Odoo v13 I found that Odoo has been removed @api.one. What is the alternative of the @api.one in Odoo v13 ? Answer In odoo13 by default instance method will accept self as multi instance (multi-recordset). So for instance method, you should remove the @api.one and @api.multi…