Skip to content

Commit

Permalink
Add kwargs to upper level download methods (#30)
Browse files Browse the repository at this point in the history
This adds kwargs to both `transactioninfo()` and `cloudevent()`
methods in the upper level `Downloader` class. The filename is
moved to a kwargs and an optional timeout argument is also added.

Fix #24

Signed-off-by: David Brown <dmlb2000@gmail.com>
  • Loading branch information
dmlb2000 committed May 15, 2020
1 parent dcea3b5 commit 8d94935
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions pacifica/downloader/downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def _download_from_url(self, location, cart_url, filename):
cart_tar.extractall(location)
cart_tar.close()

def transactioninfo(self, location, transinfo, filename='data'):
def transactioninfo(self, location, transinfo, **kwargs):
"""
Handle transaction info and download the data in a cart.
Expand All @@ -52,12 +52,13 @@ def transactioninfo(self, location, transinfo, filename='data'):
self.cart_api.wait_for_cart(
self.cart_api.setup_cart(
TransactionInfo.yield_files(transinfo)
)
),
int(kwargs.get('timeout', 120))
),
filename
kwargs.get('filename', 'data')
)

def cloudevent(self, location, cloudevent, filename='data'):
def cloudevent(self, location, cloudevent, **kwargs):
"""
Handle a cloud event and download the data in a cart.
Expand All @@ -73,7 +74,8 @@ def cloudevent(self, location, cloudevent, filename='data'):
self.cart_api.wait_for_cart(
self.cart_api.setup_cart(
CloudEvent.yield_files(cloudevent)
)
),
int(kwargs.get('timeout', 120))
),
filename
kwargs.get('filename', 'data')
)

0 comments on commit 8d94935

Please sign in to comment.