Am using this Python code upload conversion adjustments one by one, to the 
Adwords API.
However, I would like to batch them. And send up all conversions at once. 
Is this possible, and can anyone give some hints on where in the code I am 
missing something?

import uuid
import datetime
import pandas as pd
from googleads import adwords

class Adwords:
    def __init__(self, client):
        self.client = client
        self.offline_conversion_service = 
self.client.GetService('OfflineConversionAdjustmentFeedService', 
version='v201809')
        
    def upload_adjusted_conversion(self, conversion_name, order_id, 
adjustment_type, adjustment_time, adjusted_value, adjusted_value_currency):
        offline_conversion_service = 
self.client.GetService('OfflineConversionAdjustmentFeedService', 
version='v201809')

        feed = {
            'xsi_type': 'OrderIdOfflineConversionAdjustmentFeed',
            'conversionName': conversion_name,
            'orderId': order_id,
            'adjustmentType': adjustment_type,
            'adjustmentTime': adjustment_time,
            'adjustedValue': adjusted_value,
            'adjustedValueCurrencyCode': adjusted_value_currency
        }
        offline_conversion_operation = {'operator': 'ADD', 'operand': feed}
        try:
            offline_conversion_response = 
self.offline_conversion_service.mutate([offline_conversion_operation])

            new_feed = offline_conversion_response['value'][0]

            print('Uploaded offline conversion adjustment value of "%s" for 
Google ''Order ID "%s"' % (new_feed['adjustedValue'],new_feed['orderId']))
        except:
            print("Error")
            


    def 
import_conversion_adjustments_for_existing_conversions(self,dataframe):
        for row in dataframe.iterrows():
            record = row[1]
            self.upload_adjusted_conversion(record['Conversion 
Name'],record['Order ID'],record['Adjustment Type'],record['Adjustment 
Time'],record['Adjusted Value'],record['Adjusted Value Currency'])

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/68c5264c-cff0-4428-8f61-243247fec07b%40googlegroups.com.

Reply via email to