mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge pull request #352 from martenson/scripts-api-display-optional-url
fix common API scripts so they dont fail when response has no url param
This commit is contained in:
@@ -94,8 +94,10 @@ def display( url, api_key=None, return_formatted=True ):
|
||||
print 'Collection Members'
|
||||
print '------------------'
|
||||
for n, i in enumerate(r):
|
||||
# All collection members should have a name and url in the response.
|
||||
print '#%d: %s' % (n+1, i.pop( 'url' ) )
|
||||
# All collection members should have a name in the response.
|
||||
# url is optional
|
||||
if 'url' in i:
|
||||
print '#%d: %s' % (n+1, i.pop( 'url' ) )
|
||||
if 'name' in i:
|
||||
print ' name: %s' % i.pop( 'name' )
|
||||
for k, v in i.items():
|
||||
|
||||
@@ -89,8 +89,10 @@ def display( api_key, url, return_formatted=True ):
|
||||
print 'Collection Members'
|
||||
print '------------------'
|
||||
for n, i in enumerate(r):
|
||||
# All collection members should have a name and url in the response.
|
||||
print '#%d: %s' % (n+1, i.pop( 'url' ) )
|
||||
# All collection members should have a name in the response.
|
||||
# url is optional
|
||||
if 'url' in i:
|
||||
print '#%d: %s' % (n+1, i.pop( 'url' ) )
|
||||
if 'name' in i:
|
||||
print ' name: %s' % i.pop( 'name' )
|
||||
for k, v in i.items():
|
||||
|
||||
Reference in New Issue
Block a user