def main(client, order_id, targeted_placement_ids):
  # Initialize appropriate service.
  line_item_service = client.GetService('LineItemService', version='v201511')

  # Create line item objects.
  line_items = []
  for i in xrange(5):
    line_item = {
        'name': uuid.uuid4() % 'Line item #%s',
        'orderId': order_id,
        'targeting': {
            'inventoryTargeting': {
                'targetedPlacementIds': targeted_placement_ids
            },
            'geoTargeting': {
                'targetedLocations': [
                    {
                        'id': '2840',
                        'displayName': 'US'
                    },
                    {
                        'id': '20133',
                        'displayName': 'Geneva'
                    },
                    {
                        'id': '9000093',
                        'displayName': 'B3P',
                    }
                ],
                'excludedLocations': [
                    {
                        'id': '1016367',
                        'displayName': 'Chicago',
                    },
                    {
                        'id': '200501',
                        'displayName': 'New York NY'
                    }
                ]
            },
            'dayPartTargeting': {
                'dayParts': [
                    {
                        'dayOfWeek': 'SATURDAY',
                        'startTime': {
                            'hour': '0',
                            'minute': 'ZERO'
                        },
                        'endTime': {
                            'hour': '24',
                            'minute': 'ZERO'
                        }
                    },
                    {
                        'dayOfWeek': 'SUNDAY',
                        'startTime': {
                            'hour': '0',
                            'minute': 'ZERO'
                        },
                        'endTime': {
                            'hour': '24',
                            'minute': 'ZERO'
                        }
                    }
                ],
                'timeZone': 'BROWSER'
            },
            'userDomainTargeting': {
                'domains': ['usa.gov'],
                'targeted': 'false'
            },
            'technologyTargeting': {
                'browserTargeting': {
                    'browsers': [{'id': '500072'}],
                    'isTargeted': 'true'
                }
            }
        },
        'creativePlaceholders': [
            {
                'size': {
                    'width': '300',
                    'height': '250'
                }
            },
            {
                'size': {
                    'width': '120',
                    'height': '600'
                }
            }
        ],
        'startDateTimeType': 'IMMEDIATELY',
        'lineItemType': 'STANDARD',
        'endDateTime': {
            'date': {
                'year': str(date.today().year + 1),
                'month': '9',
                'day': '30'
            },
            'hour': '0',
            'minute': '0',
            'second': '0',
            'timeZoneID': 'America/Los_Angeles'
        },
        'costType': 'CPM',
        'costPerUnit': {
            'currencyCode': 'USD',
            'microAmount': '2000000'
        },
        'primaryGoal': {
            'units': '50',
            'unitType': 'IMPRESSIONS',
            'goalType': 'LIFETIME'
        },
        'contractedUnitsBought': '100',
        'creativeRotationType': 'EVEN',
        'discountType': 'PERCENTAGE',
        'allowOverbook': 'true'
    }
    line_items.append(line_item)

  # Add line items.
  line_items = line_item_service.createLineItems(line_items)

  # Display results.
  for line_item in line_items:
    print ('Line item with id \'%s\', belonging to order id \'%s\', and named '
           '\'%s\' was created.' % (line_item['id'], line_item['orderId'],
                                    line_item['name']))
dataset/ETHPy150Open googleads/googleads-python-lib/examples/dfp/v201511/line_item_service/create_line_items.py/main/swapped operands of `%`