#NEWLINE# def __init__( self , environment = 'practice' , access_token = None , headers = None ) : #NEWLINE# #INDENT# "Instantiates an instance of OandaPy's API wrapper\n        :param environment: (optional) Provide the environment for oanda's REST api, either 'sandbox', 'practice', or 'live'. Default: practice\n        :param access_token: (optional) Provide a valid access token if you have one. This is required if the environment is not sandbox.\n        " #NEWLINE# if ( environment == 'sandbox' ) : #NEWLINE# #INDENT# self . api_url = 'http://api-sandbox.oanda.com' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( environment == 'practice' ) : #NEWLINE# #INDENT# self . api_url = 'https://api-fxpractice.oanda.com' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( environment == 'live' ) : #NEWLINE# #INDENT# self . api_url = 'https://api-fxtrade.oanda.com' #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# self . access_token = access_token #NEWLINE# self . client = requests . Session ( ) #NEWLINE# if self . access_token : #NEWLINE# #INDENT# self . client . headers [ 'Authorization' ] = ( 'Bearer ' + self . access_token ) #NEWLINE# #UNINDENT# if headers : #NEWLINE# #INDENT# self . client . headers . update ( headers )