{"action":"closed","issue":{"url":"https://api.github.com/repos/bio2bel/mirbase/issues/8","repository_url":"https://api.github.com/repos/bio2bel/mirbase","labels_url":"https://api.github.com/repos/bio2bel/mirbase/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/bio2bel/mirbase/issues/8/comments","events_url":"https://api.github.com/repos/bio2bel/mirbase/issues/8/events","html_url":"https://github.com/bio2bel/mirbase/issues/8","id":347402756,"node_id":"MDU6SXNzdWUzNDc0MDI3NTY=","number":8,"title":"Re-write download function","user":{"login":"cthoyt","id":5069736,"node_id":"MDQ6VXNlcjUwNjk3MzY=","avatar_url":"https://avatars0.githubusercontent.com/u/5069736?v=4","gravatar_id":"","url":"https://api.github.com/users/cthoyt","html_url":"https://github.com/cthoyt","followers_url":"https://api.github.com/users/cthoyt/followers","following_url":"https://api.github.com/users/cthoyt/following{/other_user}","gists_url":"https://api.github.com/users/cthoyt/gists{/gist_id}","starred_url":"https://api.github.com/users/cthoyt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cthoyt/subscriptions","organizations_url":"https://api.github.com/users/cthoyt/orgs","repos_url":"https://api.github.com/users/cthoyt/repos","events_url":"https://api.github.com/users/cthoyt/events{/privacy}","received_events_url":"https://api.github.com/users/cthoyt/received_events","type":"User","site_admin":false},"labels":[{"id":633763077,"node_id":"MDU6TGFiZWw2MzM3NjMwNzc=","url":"https://api.github.com/repos/bio2bel/mirbase/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"state":"closed","locked":false,"assignee":{"login":"lingling93","id":35818198,"node_id":"MDQ6VXNlcjM1ODE4MTk4","avatar_url":"https://avatars1.githubusercontent.com/u/35818198?v=4","gravatar_id":"","url":"https://api.github.com/users/lingling93","html_url":"https://github.com/lingling93","followers_url":"https://api.github.com/users/lingling93/followers","following_url":"https://api.github.com/users/lingling93/following{/other_user}","gists_url":"https://api.github.com/users/lingling93/gists{/gist_id}","starred_url":"https://api.github.com/users/lingling93/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lingling93/subscriptions","organizations_url":"https://api.github.com/users/lingling93/orgs","repos_url":"https://api.github.com/users/lingling93/repos","events_url":"https://api.github.com/users/lingling93/events{/privacy}","received_events_url":"https://api.github.com/users/lingling93/received_events","type":"User","site_admin":false},"assignees":[{"login":"lingling93","id":35818198,"node_id":"MDQ6VXNlcjM1ODE4MTk4","avatar_url":"https://avatars1.githubusercontent.com/u/35818198?v=4","gravatar_id":"","url":"https://api.github.com/users/lingling93","html_url":"https://github.com/lingling93","followers_url":"https://api.github.com/users/lingling93/followers","following_url":"https://api.github.com/users/lingling93/following{/other_user}","gists_url":"https://api.github.com/users/lingling93/gists{/gist_id}","starred_url":"https://api.github.com/users/lingling93/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lingling93/subscriptions","organizations_url":"https://api.github.com/users/lingling93/orgs","repos_url":"https://api.github.com/users/lingling93/repos","events_url":"https://api.github.com/users/lingling93/events{/privacy}","received_events_url":"https://api.github.com/users/lingling93/received_events","type":"User","site_admin":false}],"milestone":null,"comments":0,"created_at":"2018-08-03T13:44:49Z","updated_at":"2018-08-06T09:12:18Z","closed_at":"2018-08-06T09:12:18Z","author_association":"MEMBER","body":"This was a great first attempt:\r\n\r\nhttps://github.com/bio2bel/mirbase/blob/3b4e811be77c1ee32cf3d11990940deb48b99027/src/bio2bel_mirbase/download.py#L10-L12\r\n\r\nNow, we should implement this function to be smarter and not re-download the file each time. Here's an example from Bio2BEL ChEBI:\r\n\r\n```python\r\nimport logging\r\n\r\n# build the logger using this module's name at runtime\r\nlog = logging.getLogger(__name__)\r\n\r\ndef download_compounds(force_download=False):\r\n    \"\"\"Downloads the compounds information\r\n\r\n    :param bool force_download: If true, overwrites a previously cached file\r\n    :rtype: str\r\n    \"\"\"\r\n    if os.path.exists(COMPOUNDS_DATA_PATH) and not force_download:\r\n        log.info('using cached data at %s', COMPOUNDS_DATA_PATH)\r\n    else:\r\n        log.info('downloading %s to %s', COMPOUNDS_URL, COMPOUNDS_DATA_PATH)\r\n        urlretrieve(COMPOUNDS_URL, COMPOUNDS_DATA_PATH)\r\n\r\n    return COMPOUNDS_DATA_PATH\r\n```\r\n\r\nBasically, it adds a check if the data file already exists and doesn't download it again if it does (and gives some nice logging).\r\n"}}
{"actor":{"display_login":"lingling93"}}