discogs / discogs_client

DEPRECATED - Official Python Client for the Discogs API
http://www.discogs.com/developers
Other
479 stars 132 forks source link

Is there a way to retrive the UPC by searching for album #65

Closed dtfiedler closed 8 years ago

dtfiedler commented 8 years ago

I'd like to get the UPC associated with an album name. Is the UPC returned when searching and if so how do I get it?

Thanks!

rodneykeeling commented 8 years ago

Yes, you can find any barcode/UPC info in the .data key of a Release object. For example:

results = ds.search('foo fighters', type='release').page(1)
release = results[0]
barcodes = release.data.get('barcodes')
print(barcodes)
=> [u'8 8697-98321-1 4',
 u'88697974121-A CB 88697983211-A',
 u'88697974121-B CB 88697983211-B',
 u'-23407- P.USA',
 u'8869798321-A',
 u'8869798321-B',
 u'88697983211-I1']
dtfiedler commented 8 years ago

got it. thanks!