Returns a client account's Campaigns that haven't been removed.

    Args:
      client_customer_id: str Client Customer Id used to retrieve Campaigns.

    Returns:
      list List of Campaign data objects.
421187
def GetCampaigns(self, client_customer_id):
    
    self.client.SetClientCustomerId(client_customer_id)
    # A somewhat hackish workaround for "The read operation timed out" error,
    # which could be triggered on AppEngine's end if the request is too large
    # and is taking too long.
    max_tries = 3
    today = time.strftime('%Y%m%d', time.localtime())
    for i in xrange(1, max_tries + 1):
      try:
        selector = {
            'fields': ['Id', 'Name', 'Status', 'BudgetId', 'Amount'],
            'predicates': [
                {
                    'field': 'Status',
                    'operator': 'NOT_EQUALS',
                    'values': ['REMOVED']
                }
            ],
            'dateRange': {
                'min': today,
                'max': today
            }
        }
        campaigns = self.client.GetService('CampaignService').get(selector)
        if int(campaigns['totalNumEntries']) > 0:
          return campaigns['entries']
        else:
          return None
      except Exception, e:
        if i == max_tries:
          raise GoogleAdsError(e)
        continue
178075
def get_clients(self, limit=None, offset=None):
        
        data = {}
        if limit:
            data['limit'] = limit
        if offset:
            data['offset'] = offset
        result = self._request('GET', '/clients', data=json.dumps(data))
        return result.json()
795687
public function getClientActiveProjects($client_id)
    {
        $result = $this->getClientProjects( $client_id );
        if ( $result->isSuccess() ) {
            $projects = array();
            foreach ($result->data as $project) {
                if ($project->active == "true") {
                    $projects[$project->id] = $project;
                }
            }
            $result->data = $projects;
        }

        return $result;
    }
65953
def GetCampaignFeeds(client, feed, placeholder_type):
  
  campaign_feed_service = client.GetService('CampaignFeedService', 'v201809')

  campaign_feeds = []
  more_pages = True

  selector = {
      'fields': ['CampaignId', 'MatchingFunction', 'PlaceholderTypes'],
      'predicates': [
          {
              'field': 'Status',
              'operator': 'EQUALS',
              'values': ['ENABLED']
          },
          {
              'field': 'FeedId',
              'operator': 'EQUALS',
              'values': [feed['id']]
          },
          {
              'field': 'PlaceholderTypes',
              'operator': 'CONTAINS_ANY',
              'values': [placeholder_type]
          }
      ],
      'paging': {
          'startIndex': 0,
          'numberResults': PAGE_SIZE
      }
  }

  while more_pages:
    page = campaign_feed_service.get(selector)

    if 'entries' in page:
      campaign_feeds.extend(page['entries'])

    selector['paging']['startIndex'] += PAGE_SIZE
    more_pages = selector['paging']['startIndex'] < int(page['totalNumEntries'])

  return campaign_feeds
1161206
def get_recurring_bill_by_subscription(self, subscription_id):
        
        params = {
            "subscriptionId": subscription_id,
        }
        return self.client._get(self.url + 'recurringBill', params=params, headers=self.get_headers())
338837
def _get_client_from_cache(self, client_id):
        
        data = self._read_uaa_cache()

        # Only if we've cached any for this issuer
        if self.uri not in data:
            return

        for client in data[self.uri]:
            if client['id'] == client_id:
                return client
1230258
def RemoveAllClientLabels(self, client_id):
    
    labels_to_remove = set(
        [l.name for l in data_store.REL_DB.ReadClientLabels(client_id)])
    self.RemoveClientLabels(client_id, labels_to_remove)
277537
def client_list(self, _type=None):
        
        "Returns a list of currently connected clients"
        if _type is not None:
            client_types = ('normal', 'master', 'replica', 'pubsub')
            if str(_type).lower() not in client_types:
                raise DataError("CLIENT LIST _type must be one of %r" % (
                                client_types,))
            return self.execute_command('CLIENT LIST', Token.get_token('TYPE'),
                                        _type)
        return self.execute_command('CLIENT LIST')
829427
def show_customer(self, customer_id):
        """"""
        request = self._get('customers/' + str(customer_id))
        return self.responder(request)
713514
def client_list(self, *args):
        """"""
        if len(self._clients) == 0:
            self.log('No clients connected')
        else:
            self.log(self._clients, pretty=True)
604015
def get_customer_transitions(self, issue_id_or_key):
        
        url = 'rest/servicedeskapi/request/{}/transition'.format(issue_id_or_key)

        return self.get(url, headers=self.experimental_headers)
149758
def audit_customer_subscription(customer, unknown=True):
    
    if (hasattr(customer, 'suspended') and customer.suspended):
        result = AUDIT_RESULTS['suspended']
    else:
        if hasattr(customer, 'subscription'):
            try:
                result = AUDIT_RESULTS[customer.subscription.status]
            except KeyError, err:
                # TODO should this be a more specific exception class?
                raise Exception("Unable to locate a result set for \
subscription status %s in ZEBRA_AUDIT_RESULTS") % str(err)
        else:
            result = AUDIT_RESULTS['no_subscription']
    return result
1213180
def fetch(self, customer_id, data={}, **kwargs):
        "
        return super(Customer, self).fetch(customer_id, data, **kwargs)
386397
def get(self):
    """"""
    client_customer_id = self.request.get('clientCustomerId')

    template_values = {
        'back_url': '/showAccounts',
        'back_msg': 'View Accounts.',
        'ccid': client_customer_id,
        'logout_url': users.create_logout_url('/'),
        'user_nickname': users.get_current_user().nickname()
    }

    try:
      try:
        app_user = InitUser()

        # Load Client instance.
        handler = APIHandler(app_user.client_id,
                             app_user.client_secret,
                             app_user.refresh_token,
                             app_user.adwords_manager_cid,
                             app_user.developer_token)

        campaigns = handler.GetCampaigns(client_customer_id)
      except Exception, e:
        template_values['error'] = str(e)
    finally:
      # Use template to write output to the page.
      template_values['campaigns'] = campaigns
      path = os.path.join(os.path.dirname(__file__),
                          '../templates/show_campaigns.html')
      self.response.out.write(template.render(path, template_values))
225620
def get_client_history(self, client):
        
        data = self._request('GET', '/clients/{}/history'.format(client))
        return data.json()
643245
def client_getter():
    """"""
    def wrapper(f):
        @wraps(f)
        def decorated(*args, **kwargs):
            if 'client_id' not in kwargs:
                abort(500)

            client = Client.query.filter_by(
                client_id=kwargs.pop('client_id'),
                user_id=current_user.get_id(),
            ).first()

            if client is None:
                abort(404)

            return f(client, *args, **kwargs)
        return decorated
    return wrapper
572798
public boolean removeCustomer(Long customerId) {
        Customer customer = getCustomer(customerId);
        if(customer != null){
            customerRepository.delete(customer);
            return true;
        }
        return false;
    }