Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(9)  |  Call(6)  |  Derive(0)  |  Import(3)
Makes a POST request to the hub. If no hub_url is provided, the
value is fetched from the PUSH_HUB setting.

Returns a `requests.models.Response` object.

        def ping_hub(feed_url, hub_url=None):
    """
    Makes a POST request to the hub. If no hub_url is provided, the
    value is fetched from the PUSH_HUB setting.

    Returns a `requests.models.Response` object.
    """
    if hub_url is None:
        hub_url = getattr(settings, 'PUSH_HUB', None)
    if hub_url is None:
        raise ValueError("Specify hub_url or set the PUSH_HUB setting.")
    params = {
        'hub.mode': 'publish',
        'hub.url': feed_url,
    }
    return requests.post(hub_url, data=params, headers={'User-Agent': UA})
        


src/d/j/djang0byte-HEAD/src/main/forms.py   djang0byte(Download)
import json
from django import forms
from django_push.publisher import ping_hub
from tagging.models import Tag
from timezones.forms import TimeZoneField
            Notify.new_mention_notify(mention, post=inst)
        if settings.PUBSUB:
            ping_hub(settings.FEED_URL, hub_url=settings.PUSH_HUB)
        return inst
 
            Notify.new_mention_notify(mention, post=post)
        if settings.PUBSUB:
            ping_hub(settings.FEED_URL, hub_url=settings.PUSH_HUB)
        return post
 

src/d/j/djang0byte-HEAD/src/main/models.py   djang0byte(Download)
#       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
#       MA 02110-1301, USA.
from django_push.publisher import ping_hub
 
from treebeard.ns_tree import NS_Node

src/d/j/django-push-HEAD/tests/publisher/tests.py   django-push(Download)
 
from django_push import UA
from django_push.publisher import ping_hub
 
 
    def test_explicit_ping(self, post):
        post.return_value = 'Response'
        with self.assertRaises(ValueError):
            ping_hub('http://example.com/feed')
 
        ping_hub('http://example.com/feed', hub_url='http://example.com/hub')
    def test_ping_settings(self, post):
        post.return_value = 'Response'
        ping_hub('http://example.com/feed')
        post.assert_called_once_with(
            'http://hub.example.com',
    def test_ping_settings_override(self, post):
        post.return_value = 'Response'
        ping_hub('http://example.com/feed', hub_url='http://google.com')
        post.assert_called_once_with(
            'http://google.com',