Search code examples
pythongoogle-drive-apioauth2client

How to set the gflags 'positional_parameters_enforcement' flag


How are you supposed to set this programatically for the oauth2 module? I have tried the following, but get a key error:

from oauth2client.client import OAuth2Credentials
import gflags

gflags.FLAGS['--positional_parameters_enforcement'] = 'EXCEPTION'

Solution

  • More reliably, this can be set in the following way:

    import oauth2client.util
    oauth2client.util.positional_parameter_enforcement = \
        oauth2client.util.POSITIONAL_IGNORE
    
    from oauth2client.client import OAuth2Credentials