Find the pingback URL for each URLs.
773454
def find_pingback_urls(self, urls):
        
        pingback_urls = {}

        for url in urls:
            try:
                page = urlopen(url)
                headers = page.info()

                server_url = headers.get('X-Pingback')

                if not server_url:
                    content_type = headers.get('Content-Type', '').split(
                        ';')[0].strip().lower()
                    if content_type in ['text/html', 'application/xhtml+xml']:
                        server_url = self.find_pingback_href(
                            page.read(5 * 1024))

                if server_url:
                    server_url_splitted = urlsplit(server_url)
                    if not server_url_splitted.netloc:
                        url_splitted = urlsplit(url)
                        server_url = '%s://%s%s' % (url_splitted.scheme,
                                                    url_splitted.netloc,
                                                    server_url)
                    pingback_urls[url] = server_url
            except IOError:
                pass
        return pingback_urls
461724
def resource_urls(request):
    """"""

    url_parsed = urlparse(settings.SEARCH_URL)
    defaults = dict(
        APP_NAME=__description__,
        APP_VERSION=__version__,
        SITE_URL=settings.SITE_URL.rstrip('/'),
        SEARCH_TYPE=settings.SEARCH_TYPE,
        SEARCH_URL=settings.SEARCH_URL,
        SEARCH_IP='%s://%s:%s' % (url_parsed.scheme, url_parsed.hostname, url_parsed.port)
    )
    return defaults
617695
def all_server_links(server_id, rel_to=None):
    """"""
    return [
        server_link(rel, server_id, self_rel=(rel == rel_to))
        for rel in ('delete-server', 'get-server-info', 'server-command')
    ]
588986
def router_connections(self):
        """"""
        clients = []
        for server in self._routers:
            if Servers().is_alive(server):
                client = self.create_connection(Servers().hostname(server))
                clients.append(client)
        return clients
753734
def get_urlpatterns(self):
        
        return [
            url(r'', include(self.forum_urlpatterns_factory.urlpatterns)),
            url(r'', include(self.conversation_urlpatterns_factory.urlpatterns)),
            url(_(r'^feeds/'), include(self.feeds_urlpatterns_factory.urlpatterns)),
            url(_(r'^member/'), include(self.member_urlpatterns_factory.urlpatterns)),
            url(_(r'^moderation/'), include(self.moderation_urlpatterns_factory.urlpatterns)),
            url(_(r'^search/'), include(self.search_urlpatterns_factory.urlpatterns)),
            url(_(r'^tracking/'), include(self.tracking_urlpatterns_factory.urlpatterns)),
        ]
647306
async def getlinks(url):
    """"""
    page = Linkfetcher(url)
    await page.linkfetch()
    for i, url in enumerate(page):
        return (i, url)
463351
def generate_pingback_content(soup, target, max_length, trunc_char='...'):
    
    link = soup.find('a', href=target)

    content = strip_tags(six.text_type(link.findParent()))
    index = content.index(link.string)

    if len(content) > max_length:
        middle = max_length // 2
        start = index - middle
        end = index + middle

        if start <= 0:
            end -= start
            extract = content[0:end]
        else:
            extract = '%s%s' % (trunc_char, content[start:end])

        if end < len(content):
            extract += trunc_char
        return extract

    return content
1164798
def get_urlpatterns(self):
        
        return [
            path(_('topics/'), self.latest_topics_feed(), name='latest_topics'),
            path(
                _('forum/<str:forum_slug>-<int:forum_pk>/topics/'),
                self.latest_topics_feed(),
                name='forum_latest_topics',
            ),
            path(
                _('forum/<str:forum_slug>-<int:forum_pk>/topics/all/'),
                self.latest_topics_feed(),
                {'descendants': True},
                name='forum_latest_topics_with_descendants',
            ),
        ]
314488
function(req, res, router) {
    if (router.static) {
      findPath(req, res, router, function() {
        if (!routeFinder(router, req, res)) {
          routeNoFound(req, res);
        }
      });
    } else {
      if (!routeFinder(router, req, res)) {
        routeNoFound(req, res);
      }
    }
  }
1190386
def get_urls(self):
        
        urls = super(IPAdmin, self).get_urls()
        my_urls = patterns(
            '',
            url(r'^batch_process_ips/$', self.admin_site.admin_view(self.batch_process_ips_view), name='batch_process_ips_view')
        )
        return my_urls + urls
1055021
def url(self, host):
        """"""
        path = '/'.join(str(v) for v in self._path)
        return 'coaps://{}:5684/{}'.format(host, path)
964853
def url_for(self, *args: str, **kwargs: str) -> URL:
        """"""
        return self._resource.url_for(*args, **kwargs)
733552
def ping():
    '''
    
    '''
    r = salt.utils.http.query(DETAILS['url']+'ping', decode_type='json', decode=True)
    try:
        return r['dict'].get('ret', False)
    except Exception:
        return False
98418
def ping(self):
        
        url = self._build_url('pings', base_url=self._api)
        return self._boolean(self._post(url), 204, 404)
1206541
def ping():
    '''
    

    '''
    r = __salt__['dracr.system_info'](host=DETAILS['host'],
                                      admin_username=DETAILS['admin_username'],
                                      admin_password=DETAILS['admin_password'])
    if r.get('retcode', 0) == 1:
        return False
    else:
        return True
    try:
        return r['dict'].get('ret', False)
    except Exception:
        return False
637235
def ping_directories(self, request, queryset, messages=True):
        
        for directory in settings.PING_DIRECTORIES:
            pinger = DirectoryPinger(directory, queryset)
            pinger.join()
            if messages:
                success = 0
                for result in pinger.results:
                    if not result.get('flerror', True):
                        success += 1
                    else:
                        self.message_user(request,
                                          '%s : %s' % (directory,
                                                       result['message']))
                if success:
                    self.message_user(
                        request,
                        _('%(directory)s directory succesfully '
                          'pinged %(success)d entries.') %
                        {'directory': directory, 'success': success})
1283871
def get_urls(self):
        

        info = self.model._meta.app_label, self.model._meta.model_name
        return [
            url(r'^report/(?P<key>\w+)/(?P<period>\w)$',
                self.admin_site.admin_view(self.report_view),
                name='%s_%s_tracking_report' % info)
        ] + super(TrackedLiveAdmin, self).get_urls()