WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion coinbase/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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()

Expand Down