Monday 15 July 2013

python - Finding out which mode I am in with Braintree -



python - Finding out which mode I am in with Braintree -

is there method phone call see if in sandbox or production mode? here have far:

import braintree braintree.configuration.configure(braintree.environment.sandbox, braintree_merchant, braintree_public_key, braintree_secret_key) >>> braintree.environment # how this? 'sandbox'

from braintree_python source code (3.6), be: braintree.configuration.environment

here's relevant source code convenience:

class configuration(object): """ class representing configuration of braintree account. must phone call configure before other braintree operations. :: braintree.configuration.configure( braintree.environment.sandbox, "your_merchant_id", "your_public_key", "your_private_key" ) """ @staticmethod def configure(environment, merchant_id, public_key, private_key, **kwargs): configuration.environment = environment configuration.merchant_id = merchant_id # .. see more on github

so, in illustration above:

import braintree braintree.configuration.configure(braintree.environment.sandbox, braintree_merchant, braintree_public_key, braintree_secret_key) >>> braintree.configuration.environment._environment__server 'api.sandbox.braintreegateway.com'

python braintree

No comments:

Post a Comment