/usr/lib/python3/dist-packages/braintree/environment.py is in python3-braintree 3.38.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | import os
import inspect
from braintree.exceptions.configuration_error import ConfigurationError
class Environment(object):
"""
A class representing which environment the client library is using.
Pass in one of the following values as the first argument to
:class:`braintree.Configuration.configure() <braintree.configuration.Configuration>` ::
braintree.Environment.Sandbox
braintree.Environment.Production
"""
def __init__(self, name, server, port, auth_url, is_ssl, ssl_certificate):
self.__name__ = name
self.__server = server
self.__port = port
self.is_ssl = is_ssl
self.ssl_certificate = ssl_certificate
self.__auth_url = auth_url
@property
def base_url(self):
return "%s%s:%s" % (self.protocol, self.server, self.port)
@property
def port(self):
return int(self.__port)
@property
def auth_url(self):
return self.__auth_url
@property
def protocol(self):
return self.__port == "443" and "https://" or "http://"
@property
def server(self):
return self.__server
@property
def server_and_port(self):
return self.__server + ":" + self.__port
@staticmethod
def parse_environment(environment):
if isinstance(environment, Environment) or environment is None:
return environment
try:
return Environment.All[environment]
except KeyError as e:
raise ConfigurationError("Unable to process supplied environment")
@staticmethod
def braintree_root():
return os.path.dirname(inspect.getfile(Environment))
def __str__(self):
return self.__name__
Environment.Development = Environment("development", "localhost", os.getenv("GATEWAY_PORT") or "3000", "http://auth.venmo.dev:9292", False, None)
Environment.QA = Environment("qa", "gateway.qa.braintreepayments.com", "443", "http://auth.qa.venmo.com", True, Environment.braintree_root() + "/ssl/api_braintreegateway_com.ca.crt")
Environment.Sandbox = Environment("sandbox", "api.sandbox.braintreegateway.com", "443", "https://auth.sandbox.venmo.com", True, Environment.braintree_root() + "/ssl/api_braintreegateway_com.ca.crt")
Environment.Production = Environment("production", "api.braintreegateway.com", "443", "https://auth.venmo.com", True, Environment.braintree_root() + "/ssl/api_braintreegateway_com.ca.crt")
Environment.All = {
"development": Environment.Development,
"integration": Environment.Development,
"qa": Environment.QA,
"sandbox": Environment.Sandbox,
"production": Environment.Production
}
|