def main(client):
  # Initialize appropriate service.
  media_service = client.GetService('MediaService', version='v201509')

  # Construct selector and get all images.
  offset = 0
  selector = {
      'fields': ['MediaId', 'Type', 'Width', 'Height', 'MimeType'],
      'predicates': [{
          'field': 'Type',
          'operator': 'IN',
          'values': ['IMAGE', 'VIDEO']
      }],
      'paging': {
          'startIndex': str(offset),
          'numberResults': str(PAGE_SIZE)
      }
  }
  more_pages = True
  while more_pages:
    page = media_service.get(selector)

    # Display results.
    if 'entries' in page:
      for image in page['entries']:
        try:
          dimensions = dict([(entry['key'], entry['value'])
                             for entry in image['dimensions']])
        except __HOLE__:
          dimensions = {'FULL': {'height': 0, 'width': 0}}
        if image['type'] == 'IMAGE':
          print ('%s with id \'%s\', dimensions \'%sx%s\', and MimeType \'%s\''
                 ' was found.' % (image['type'], image['mediaId'],
                                  dimensions['FULL']['height'],
                                  dimensions['FULL']['width'],
                                  image['mimeType']))
        elif image['type'] == 'VIDEO':
          print ('%s with id \'%s\' was found.' % (image['type'],
                                                   image['mediaId']))
    else:
      print 'No images/videos were found.'
    offset += PAGE_SIZE
    selector['paging']['startIndex'] = str(offset)
    more_pages = offset < int(page['totalNumEntries'])
dataset/ETHPy150Open googleads/googleads-python-lib/examples/adwords/v201509/misc/get_all_images_and_videos.py/main