def GetFeedMapping(client, feed, placeholder_type):
 feed_mapping_service = client.GetService('FeedMappingService', 'v201607')
 attribute_mappings = {}
 more_pages = True
 selector = {'fields': ['FeedMappingId', 'AttributeFieldMappings'], 'predicates': [{'field': 'FeedId', 'operator': 'EQUALS', 'values': [feed['id']]}, {'field': 'PlaceholderType', 'operator': 'EQUALS', 'values': [placeholder_type]}], 'paging': {'startIndex': 0, 'numberResults': PAGE_SIZE}}
 while more_pages:
  page = feed_mapping_service.get(selector)
  if ('entries' in page):
   for feed_mapping in page['entries']:
    for attribute_mapping in feed_mapping['attributeFieldMappings']:
     if (attribute_mapping['feedAttributeId'] in attribute_mappings):
      attribute_mappings[attribute_mapping['feedAttributeId']].append(attribute_mapping['fieldId'])
     else:
      attribute_mappings[attribute_mapping['feedAttributeId']] = [attribute_mapping['fieldId']]
  selector['paging']['startIndex'] += PAGE_SIZE
  more_pages = (selector['paging']['startIndex'] < int(page['totalNumEntries']))
 return attribute_mappings

def GetFeedMapping ( client , feed , placeholder_type ) : feed_mapping_service = client . GetService ( 'FeedMappingService' , 'v201607' ) attribute_mappings = { } more_pages = True selector = { 'fields' : [ 'FeedMappingId' , 'AttributeFieldMappings' ] , 'predicates' : [ { 'field' : 'FeedId' , 'operator' : 'EQUALS' , 'values' : [ feed [ 'id' ] ] } , { 'field' : 'PlaceholderType' , 'operator' : 'EQUALS' , 'values' : [ placeholder_type ] } ] , 'paging' : { 'startIndex' : 0 , 'numberResults' : PAGE_SIZE } } while more_pages : page = feed_mapping_service . get ( selector ) if ( 'entries' in page ) : for feed_mapping in page [ 'entries' ] : for attribute_mapping in feed_mapping [ 'attributeFieldMappings' ] : if ( attribute_mapping [ 'feedAttributeId' ] in attribute_mappings ) : attribute_mappings [ attribute_mapping [ 'feedAttributeId' ] ] . append ( attribute_mapping [ 'fieldId' ] ) else : attribute_mappings [ attribute_mapping [ 'feedAttributeId' ] ] = [ attribute_mapping [ 'fieldId' ] ] selector [ 'paging' ] [ 'startIndex' ] += PAGE_SIZE more_pages = ( selector [ 'paging' ] [ 'startIndex' ] < int ( page [ 'totalNumEntries' ] ) ) return attribute_mappings
gets the feed mapping for a given feed .