from adspygoogle.adwords.AdWordsClient import AdWordsClient


# Initialize client object.
client = AdWordsClient(path=os.path.join('..', '..', '..', '..'))
client.use_mcc = True

# Initialize appropriate service.
info_service = client.GetInfoService(
    'https://adwords-sandbox.google.com', 'v201008')

# Construct info selector object and retrieve usage info.
today = datetime.datetime.today()
selector = {
    'dateRange': {
        'min': today.strftime('%Y%m01'),
        'max': today.strftime('%Y%m%d')
    },
    'apiUsageType': 'OPERATION_COUNT'
}
info = info_service.Get(selector)[0]

# Display results.
print ('The total number of operations consumed during \'%s\'-\'%s\' is \'%s\'.'
       % (selector['dateRange']['min'], selector['dateRange']['max'],
          info['cost']))

print
print ('Usage: %s units, %s operations' % (client.GetUnits(),
                                           client.GetOperations()))
# Import appropriate classes from the client library.
from adspygoogle.adwords.AdWordsClient import AdWordsClient

# Initialize client object.
client = AdWordsClient(path=os.path.join('..', '..', '..', '..'))
client.use_mcc = True

# Initialize appropriate service.
info_service = client.GetInfoService('https://adwords-sandbox.google.com',
                                     'v201003')

# Construct info selector object and retrieve usage info.
today = datetime.datetime.today()
selector = {
    'dateRange': {
        'min': today.strftime('%Y%m01'),
        'max': today.strftime('%Y%m%d')
    },
    'apiUsageType': 'OPERATION_COUNT'
}
info = info_service.Get(selector)[0]

# Display results.
print(
    'The total number of operations consumed during \'%s\'-\'%s\' is \'%s\'.' %
    (selector['dateRange']['min'], selector['dateRange']['max'], info['cost']))

print
print('Usage: %s units, %s operations' %
      (client.GetUnits(), client.GetOperations()))