Creates a webhook with given attributes.
181197
def create(self, attributes=None, **kwargs):
        

        return super(WebhooksProxy, self).create(resource_id=None, attributes=attributes)
807855
def process_webhooks(webhooks)
      webhooks.each do |element|
        webhook = Webhook.new(element, @bot)
        @webhooks[webhook.id] = webhook
      end
    end
633501
def webhooks(request):
    

    if request.method != "POST":
        return HttpResponse("Invalid Request.", status=400)

    json = simplejson.loads(request.POST["json"])

    if json["event"] == "recurring_payment_failed":
        zebra_webhook_recurring_payment_failed.send(sender=None, customer=_try_to_get_customer_from_customer_id(json["customer"]), full_json=json)

    elif json["event"] == "invoice_ready":
        zebra_webhook_invoice_ready.send(sender=None, customer=_try_to_get_customer_from_customer_id(json["customer"]), full_json=json)

    elif json["event"] == "recurring_payment_succeeded":
        zebra_webhook_recurring_payment_succeeded.send(sender=None, customer=_try_to_get_customer_from_customer_id(json["customer"]), full_json=json)

    elif json["event"] == "subscription_trial_ending":
        zebra_webhook_subscription_trial_ending.send(sender=None, customer=_try_to_get_customer_from_customer_id(json["customer"]), full_json=json)

    elif json["event"] == "subscription_final_payment_attempt_failed":
        zebra_webhook_subscription_final_payment_attempt_failed.send(sender=None, customer=_try_to_get_customer_from_customer_id(json["customer"]), full_json=json)

    elif json["event"] == "ping":
        zebra_webhook_subscription_ping_sent.send(sender=None)

    else:
        return HttpResponse(status=400)

    return HttpResponse(status=200)
822514
def create_scraper(cls, sess=None, **kwargs):
        
        scraper = cls(**kwargs)

        if sess:
            attrs = ["auth", "cert", "cookies", "headers", "hooks", "params", "proxies", "data"]
            for attr in attrs:
                val = getattr(sess, attr, None)
                if val:
                    setattr(scraper, attr, val)

        return scraper
181311
function(webhookId, callback) {
      utils.debug('Webhooks get: ' + webhookId);
      request.get({
        path: '/webhooks/' + utils.toUUID(webhookId),
      }, callback);
    }
1226155
def add_webhook(self, scaling_group, policy, name, metadata=None):
        
        return self._manager.add_webhook(scaling_group, policy, name,
                metadata=metadata)
741861
def create_hooks(use_tfdbg=False,
                 use_dbgprofile=False,
                 dbgprofile_kwargs=None,
                 use_validation_monitor=False,
                 validation_monitor_kwargs=None,
                 use_early_stopping=False,
                 early_stopping_kwargs=None):
  """"""
  train_hooks = []
  eval_hooks = []

  if use_tfdbg:
    hook = debug.LocalCLIDebugHook()
    train_hooks.append(hook)
    eval_hooks.append(hook)

  if use_dbgprofile:
    # Recorded traces can be visualized with chrome://tracing/
    # The memory/tensor lifetime is also profiled
    tf.logging.info("Using ProfilerHook")
    defaults = dict(save_steps=10, show_dataflow=True, show_memory=True)
    defaults.update(dbgprofile_kwargs)
    train_hooks.append(tf.train.ProfilerHook(**defaults))

  if use_validation_monitor:
    tf.logging.info("Using ValidationMonitor")
    train_hooks.append(
        tf.contrib.learn.monitors.ValidationMonitor(
            hooks=eval_hooks, **validation_monitor_kwargs))

  if use_early_stopping:
    tf.logging.info("Using EarlyStoppingHook")
    hook = metrics_hook.EarlyStoppingHook(**early_stopping_kwargs)
    # Adding to both training and eval so that eval aborts as well
    train_hooks.append(hook)
    eval_hooks.append(hook)

  return train_hooks, eval_hooks
1214361
public function createHook(string $org, string $name, $config, array $events = [AbstractApi::EVENTS_PUSH],
                               bool $active = false): array
    {
        return $this->getApi()->request($this->getApi()->sprintf('/orgs/:org/hooks', $org), Request::METHOD_POST, [
                'name'   => $name,
                'config' => $config,
                'events' => $events,
                'active' => $active
            ]);
    }
1051782
def create
      request = Request.post_xml('authorizations/request', api_version, credentials, xml)
      response = Response.new(request)
      update_attributes(response.serialize)

      response.success?
    end
221945
def create(attributes)
      response = JSON.parse(@client.post('fees', attributes).body)
      Promisepay::Fee.new(@client, response['fees'])
    end
798159
def start_webhook(dispatcher, webhook_path, *, loop=None, skip_updates=None,
                  on_startup=None, on_shutdown=None, check_ip=False, retry_after=None, route_name=DEFAULT_ROUTE_NAME,
                  **kwargs):
    
    executor = set_webhook(dispatcher=dispatcher,
                           webhook_path=webhook_path,
                           loop=loop,
                           skip_updates=skip_updates,
                           on_startup=on_startup,
                           on_shutdown=on_shutdown,
                           check_ip=check_ip,
                           retry_after=retry_after,
                           route_name=route_name)
    executor.run_app(**kwargs)
1139618
def putWebhook(self, hook_id, external_id, url, event_types):
        """"""
        path = 'notification/webhook'
        payload = {'id': hook_id, 'externalId': external_id,
                   'url': url, 'eventTypes': event_types}
        return self.rachio.put(path, payload)
1082644
def create(self, attributes):
        
        if not isinstance(attributes, dict):
            raise TypeError('Dictionary of values expected')
        attributes = json.dumps(attributes)
        return self.transport.POST(url='/space/', body=attributes, type='application/json')
604846
def call_webhook(event, webhook, payload):
    """"""
    started_at = time()

    request = _build_request_for_calling_webhook(event, webhook, payload)

    logger.info('REQUEST %(uuid)s %(method)s %(url)s %(payload)s' % dict(
        uuid=str(event['uuid']),
        url=request['url'],
        method=request['method'],
        payload=payload,
    ))

    try:
        content = dispatch_webhook_request(**request)

        logger.debug('RESPONSE %(uuid)s %(method)s %(url)s %(data)s' % dict(
            uuid=str(event['uuid']),
            url=request['url'],
            method=request['method'],
            data=content,
        ))

        data = dict(
            parent=str(event['uuid']),
            content=content,
            started_at=started_at,
            ended_at=time()
        )
    except (FailureWebhookError, ConnectionError) as exception:
        if sentry.client:
            http_context = raven_context(**request)
            sentry.captureException(data={'request': http_context})

        logger.error('RESPONSE %(uuid)s %(method)s %(url)s %(error)s' % dict(
            uuid=str(event['uuid']),
            method=request['method'],
            url=request['url'],
            error=exception.message,))

        data = dict(
            parent=str(event['uuid']),
            error=exception.message,
            started_at=started_at,
            ended_at=time(),
        )

    webhook_ran.send(None, data=data)

    return data
319275
def webhooks
      webhooks = JSON.parse(API::Server.webhooks(@bot.token, @id))
      webhooks.map { |webhook| Webhook.new(webhook, @bot) }
    end
982740
function buildWebhookEvent(options) {
  const webhookName = options.name + 'Webhook';
  let webhook = {
    Resources: {},
    Outputs: {}
  };

  validteWebhookOptions(options);

  webhook.Resources[webhookName + 'Resource'] = {
    Type: 'AWS::ApiGateway::Resource',
    Properties: {
      ParentId: cf.getAtt(webhookName + 'ApiGateway', 'RootResourceId'),
      RestApiId: cf.ref(webhookName + 'ApiGateway'),
      PathPart: options.name.toLowerCase()
    }
  };

  if (options.eventSources.webhook.method) {
    if (!options.eventSources.webhook.methodResponses) {
      options.eventSources.webhook.methodResponses = [
        {
          StatusCode: '200',
          ResponseModels: {
            'application/json': 'Empty'
          }
        },
        {
          StatusCode: '500',
          ResponseModels: {
            'application/json': 'Empty'
          }
        }
      ];
    } else if (!Array.isArray(options.eventSources.webhook.methodResponses)) {
      throw new Error('Webhook method responses is not an array');
    }

    if (!options.eventSources.webhook.integration) {
      options.eventSources.webhook.integration = {};
    }

    // sets safe defaults for missing parameters if integration object is passed
    options.eventSources.webhook.integration.Type = options.eventSources.webhook.integration.Type ? options.eventSources.webhook.integration.Type : 'AWS';
    options.eventSources.webhook.integration.IntegrationHttpMethod = options.eventSources.webhook.integration.IntegrationHttpMethod ? options.eventSources.webhook.integration.IntegrationHttpMethod : 'POST';
    options.eventSources.webhook.integration.Uri = options.eventSources.webhook.integration.Uri ? options.eventSources.webhook.integration.Uri : cf.join(['arn:aws:apigateway:', cf.region, ':lambda:path/2015-03-31/functions/', cf.getAtt(options.name, 'Arn'), '/invocations']);
    options.eventSources.webhook.integration.IntegrationResponses = options.eventSources.webhook.integration.IntegrationResponses ? options.eventSources.webhook.integration.IntegrationResponses : [{ StatusCode: '200' }, { StatusCode: '500', SelectionPattern: '^(?i)(error|exception).*'}];

    webhook.Resources[webhookName + 'Method'] = {
      Type: 'AWS::ApiGateway::Method',
      Properties: {
        RestApiId: cf.ref(webhookName + 'ApiGateway'),
        ResourceId: cf.ref(webhookName + 'Resource'),
        AuthorizationType: 'None',
        HttpMethod: options.eventSources.webhook.method.toUpperCase(),
        MethodResponses: options.eventSources.webhook.methodResponses,
        Integration: options.eventSources.webhook.integration
      }
    };
  }

  webhook.Resources[webhookName + 'Permission'] = {
    Type: 'AWS::Lambda::Permission',
    Properties: {
      FunctionName: cf.getAtt(options.name, 'Arn'),
      Action: 'lambda:InvokeFunction',
      Principal: 'apigateway.amazonaws.com',
      SourceArn: cf.join(['arn:aws:execute-api:', cf.region, ':', cf.accountId, ':', cf.ref(webhookName + 'ApiGateway'),'/*'])
    }
  };

  webhook.Resources[webhookName + 'ApiGateway'] = {
    Type: 'AWS::ApiGateway::RestApi',
    Properties: {
      Name: cf.stackName,
      FailOnWarnings: 'true'
    }
  };

  // randomizes deployment name so that code can be redeployed over an existing stage
  let apiDeploymentRandom = getApiDeploymentName();

  webhook.Resources[webhookName + 'ApiKey'] = {
    Type: 'AWS::ApiGateway::ApiKey',
    DependsOn: webhookName + apiDeploymentRandom,
    Properties: {
      Name: cf.stackName,
      Enabled: 'true',
      StageKeys: [
        {
          RestApiId: cf.ref(webhookName + 'ApiGateway'),
          StageName: 'prod'
        }
      ]
    }
  };

  webhook.Resources[webhookName + apiDeploymentRandom] = {
    Type: 'AWS::ApiGateway::Deployment',
    DependsOn: webhookName + 'Method',
    Properties: {
      RestApiId: cf.ref(webhookName + 'ApiGateway'),
      StageName: 'prod'
    }
  };

  webhook.Resources[webhookName + 'ApiLatencyAlarm'] = {
    Type: 'AWS::CloudWatch::Alarm',
    Properties: {
      EvaluationPeriods: '5',
      Statistic: 'Sum',
      Threshold: '4',
      AlarmDescription: 'https://github.com/mapbox/lambda-cfn/blob/master/alarms.md#ApiLatencyAlarm',
      Period: '60',
      AlarmActions: [
        cf.ref('ServiceAlarmSNSTopic')
      ],
      Namespace: 'AWS/ApiGateway',
      Dimensions: [
        {
          Name: 'APIName',
          Value: cf.stackName
        }
      ],
      ComparisonOperator: 'GreaterThanThreshold',
      MetricName: 'Latency'
    }
  };

  webhook.Resources[webhookName + 'Api4xxAlarm'] = {
    Type: 'AWS::CloudWatch::Alarm',
    Properties: {
      EvaluationPeriods: '5',
      Statistic: 'Sum',
      Threshold: '100',
      AlarmDescription: 'https://github.com/mapbox/lambda-cfn/blob/master/alarms.md#Api4xxAlarm',
      Period: '60',
      AlarmActions: [ cf.ref('ServiceAlarmSNSTopic') ],
      Namespace: 'AWS/ApiGateway',
      Dimensions: [
        {
          Name: 'APIName',
          Value: cf.stackName
        }
      ],
      ComparisonOperator: 'GreaterThanThreshold',
      MetricName: '4xxError'
    }
  };

  webhook.Resources[webhookName + 'ApiCountAlarm'] = {
    Type: 'AWS::CloudWatch::Alarm',
    Properties: {
      EvaluationPeriods: '5',
      Statistic: 'Sum',
      Threshold: '10000',
      AlarmDescription: 'https://github.com/mapbox/lambda-cfn/blob/master/alarms.md#ApiCountAlarm',
      Period: '60',
      AlarmActions: [
        cf.ref('ServiceAlarmSNSTopic')
      ],
      Namespace: 'AWS/ApiGateway',
      Dimensions: [
        {
          Name: 'APIName',
          Value: cf.stackName
        }
      ],
      ComparisonOperator: 'GreaterThanThreshold',
      MetricName: 'Count'
    }
  };

  webhook.Resources[webhookName + 'Permission'] = {
    Type: 'AWS::Lambda::Permission',
    Properties: {
      FunctionName: cf.getAtt(options.name, 'Arn'),
      Action: 'lambda:InvokeFunction',
      Principal: 'apigateway.amazonaws.com',
      SourceArn: cf.join(['arn:aws:execute-api:', cf.region, ':', cf.accountId, ':', cf.ref(webhookName + 'ApiGateway'), '/*'])
    }
  };

  webhook.Outputs[webhookName + 'APIEndpoint'] = {
    Value: cf.join(['https://', cf.ref(webhookName + 'ApiGateway'), '.execute-api.', cf.region, '.amazonaws.com/prod/', options.name.toLowerCase()])
  };

  if (options.eventSources.webhook.apiKey) {
    webhook.Resources[webhookName + 'Method'].Properties.ApiKeyRequired = 'true';
    webhook.Outputs[webhookName + 'ApiKey'] = {
      Value: cf.ref(webhookName + 'ApiKey')
    };
  }

  return webhook;
}
655160
def _register_webhook(self, webhook_url, events):
        """"""
        response = self._request(
            MINUT_WEBHOOKS_URL,
            request_type='POST',
            json={
                'url': webhook_url,
                'events': events,
            },
        )
        return response