diff --git a/coinbase/__init__.py b/coinbase/__init__.py index 77a6342..29f48e1 100644 --- a/coinbase/__init__.py +++ b/coinbase/__init__.py @@ -384,7 +384,8 @@ def request(self, from_email, amount, notes=''): return CoinbaseTransaction \ .from_coinbase_dict(response_parsed['transaction']) - def send(self, to_address, amount, notes='', user_fee=None, idem=None): + def send(self, to_address, amount, notes='', user_fee=None, idem=None, + token_2fa=None): """ Send BitCoin from this account to either an email address or a BTC address @@ -398,6 +399,8 @@ def send(self, to_address, amount, notes='', user_fee=None, idem=None): transaction with the same idem parameter already exists for this sender, that previous transaction will be returned and a new one will not be created. Max length 100 characters. + :param token_2fa: Optional two factor token which might be necessary + depending on user permissions :return: CoinbaseTransaction with status and details :raise: CoinbaseError with the error list received from Coinbase on failure @@ -426,6 +429,9 @@ def send(self, to_address, amount, notes='', user_fee=None, idem=None): if idem is not None: request_data['transaction']['idem'] = str(idem) + if token_2fa is not None: + self.session.headers.update({'CB-2FA-Token': token_2fa}) + response = self.session.post(url=url, data=json.dumps(request_data)) response_parsed = response.json()