Make a users subscription request
17289
function() {
    this.subscribe('user', function(error, response) {
      if (!error && response) {
        logger.info('instagram -', 'users', 'subscription confirmed');
        Subscriber.prototype.subscriptions['users'] = response.id;
      }
    });
  }
721446
def process_subscription_data(post_data):
    """"""
    subscription_data = post_data.pop("subscription", {})
    # As our database saves the auth and p256dh key in separate field,
    # we need to refactor it and insert the auth and p256dh keys in the same dictionary
    keys = subscription_data.pop("keys", {})
    subscription_data.update(keys)
    # Insert the browser name
    subscription_data["browser"] = post_data.pop("browser")
    return subscription_data
566165
def request_subscription(jid)
      unless contact = contact(jid)
        contact = Contact.new(:jid => jid)
        @roster << contact
      end
      contact.ask = 'subscribe' if %w[none from].include?(contact.subscription)
    end
1118750
def subscribe(self, subreddit, unsubscribe=False):
        
        data = {'action': 'unsub' if unsubscribe else 'sub',
                'sr_name': six.text_type(subreddit)}
        response = self.request_json(self.config['subscribe'], data=data)
        self.evict(self.config['my_subreddits'])
        return response
1019379
def get(self, request, **kwargs):
		
		customer, _created = Customer.get_or_create(
			subscriber=subscriber_request_callback(self.request)
		)

		serializer = SubscriptionSerializer(customer.subscription)
		return Response(serializer.data)
1110444
def post(self, request):
        """"""
        try:
            observer_id = request.query_params['observer']
            session_id = request.query_params['subscriber']
        except KeyError:
            return response.Response(status=400)

        observer.remove_subscriber(session_id, observer_id)
        return response.Response()
1215997
function subscribe(subscriber, immediate) {
        if (!~subscribers.indexOf(subscriber)) {
            subscribers.push(subscriber);
        }
        if (immediate) {
            subscriber(value);
        }
    }
1345728
def post(self, request, *args, **kwargs):
        """"""
        kwargs['pk'] = request.user.id
        self.kwargs['pk'] = request.user.id
        return super().post(request, *args, **kwargs)
951937
function (event) {
    this.debug("Requesting subscription for " + event);
    sendReceive.call(this, {'do': 'subscribe', params: [event]}, function (result) {
        if (result.success) {
            this.debug("Succesfully subscribed to %s", event);
        } else {
            this.debug("Subscription request for %s failed", event);
        }
    });
    this.subscribedEvents.push(event);
}
939362
def create_with_user(self, user_params, **kwargs):
        
        affiliate = self.create(**kwargs)
        self.api.affiliate_users.create(affiliate_id=affiliate.id, **user_params)
        return affiliate
941322
def subscribe(self, id, name, port):
		""""""
		sub = gntp.core.GNTPSubscribe()
		sub.add_header('Subscriber-ID', id)
		sub.add_header('Subscriber-Name', name)
		sub.add_header('Subscriber-Port', port)
		if self.password:
			sub.set_password(self.password, self.passwordHash)

		self.add_origin_info(sub)
		self.subscribe_hook(sub)

		return self._send('subscribe', sub)
460693
async def _set_subscriptions(self, subscriptions):
        

        url, params = self._get_subscriptions_endpoint()

        data = {
            'object': 'page',
            'callback_url': self.webhook_url,
            'fields': ', '.join(subscriptions),
            'verify_token': self.verify_token,
        }

        headers = {
            'Content-Type': 'application/json',
        }

        post = self.session.post(
            url,
            params=params,
            data=ujson.dumps(data),
            headers=headers,
        )

        async with post as r:
            await self._handle_fb_response(r)
            data = await r.json()
459710
def create_subscription(self, subscription):
        
        if subscription.subscription_id is not None:
            self._validate_uuid(subscription.subscription_id)

        if subscription.endpoint is not None:
            if subscription.endpoint.subscriber_id is not None:
                self._validate_subscriber_id(
                    subscription.endpoint.subscriber_id)

            if subscription.endpoint.endpoint_id is not None:
                self._validate_uuid(subscription.endpoint.endpoint_id)

        if subscription.channel is not None:
            self._validate_uuid(subscription.channel.channel_id)

        url = "/notification/v1/subscription"
        response = NWS_DAO().postURL(url, self._write_headers(),
                                     self._json_body(subscription.json_data()))

        if response.status != 201:
            raise DataFailureException(url, response.status, response.data)

        return response.status
123671
def check_subscription(self, request):
		""""""
		subscriber = subscriber_request_callback(request)

		if not subscriber_has_active_subscription(subscriber):
			if not SUBSCRIPTION_REDIRECT:
				raise ImproperlyConfigured("DJSTRIPE_SUBSCRIPTION_REDIRECT is not set.")
			return redirect(SUBSCRIPTION_REDIRECT)
879458
def subscribe(self, destination, id, ack='auto', headers=None, **keyword_headers):
        
        self.transport.subscriptions[id] = destination
976527
def has_subscriber(self, user):
        
        if not hasattr(self, '_subscribers'):
            self._subscribers = list(self.subscribers.all())
        return user in self._subscribers
1303899
def create_event_subscription(self, url):
        
        params = {'callbackUrl': url}
        response = self._do_request('POST', '/v2/eventSubscriptions', params)
        return response.json()