• Facebook
  • Twitter
  • Reddit
  • StumbleUpon
  • Digg
  • email

All Samples(72)  |  Call(49)  |  Derive(0)  |  Import(23)
Removes any existing fragment from URL.

Returns a tuple of the defragmented URL and the fragment.  If
the URL contained no fragments, the second element is the
empty string.

        def urldefrag(url):
    """Removes any existing fragment from URL.

    Returns a tuple of the defragmented URL and the fragment.  If
    the URL contained no fragments, the second element is the
    empty string.
    """
    if '#' in url:
        s, n, p, a, q, frag = urlparse(url)
        defrag = urlunparse((s, n, p, a, q, ''))
        return defrag, frag
    else:
        return url, ''
        


src/g/u/gugle.bot-1.0dev-r629/gugle/bot/linkbot.py   gugle.bot(Download)
from BeautifulSoup import BeautifulSoup, BeautifulStoneSoup
 
import re
from urlparse import urljoin, urldefrag, urlparse, urlunparse
import unicodedata
 
class Linkbot(BeautifulSoup):
 
        # It seems that allow_fragment=0 does nothing,
        # so we do it ourselves
        return urldefrag(res)[0]
 
def __main_():
    import sys, os, getopt

src/w/e/webtoolbox-HEAD/webtoolbox/clients.py   webtoolbox(Download)
# encoding: utf-8
"""
HTTP clients designed for easy tool building
"""
 
 
from urlparse import urlparse, urlunparse, urldefrag
            # http://example.com/foo are considered to be the same
 
            # Avoid wasting time reprocessing anchors, which are a browser-level behaviour:
            normalized_url = urldefrag(urlunparse((
             link_p.scheme, link_p.netloc, link_p.path, link_p.params, link_p.query, ""
            )))[0]
 

src/z/a/zamboni-lib-HEAD/lib/python/rdflib/namespace.py   zamboni-lib(Download)
 
import os
 
from urlparse import urljoin, urldefrag
from urllib import pathname2url
 
from rdflib.term import URIRef, Variable, _XSD_PFX
    def absolutize(self, uri, defrag=1):
        base = urljoin("file:", pathname2url(os.getcwd()))
        result = urljoin("%s/" % base, uri, allow_fragments=not defrag)
        if defrag:
            result = urldefrag(result)[0]
        if not defrag:
            if uri and uri[-1]=="#" and result[-1]!="#":

src/w/e/WebToolbox-0.1/webtoolbox/clients.py   WebToolbox(Download)
# encoding: utf-8
"""
HTTP clients designed for easy tool building
"""
 
 
from urlparse import urlparse, urlunparse, urldefrag
            # http://example.com/foo are considered to be the same
 
            # Avoid wasting time reprocessing anchors, which are a browser-level behaviour:
            normalized_url = urldefrag(urlunparse((
             link_p.scheme, link_p.netloc, link_p.path, link_p.params, link_p.query, ""
            )))[0]
 

src/n/o/notabene-HEAD/trunk/lib/rdflib/URIRef.py   notabene(Download)
else:
    normalize = None
 
from urlparse import urlparse, urljoin, urldefrag
 
from rdflib.Identifier import Identifier
from rdflib.compat import rsplit
    def defrag(self):
        if "#" in self:
            url, frag = urldefrag(self)
            return URIRef(url)
        else:
            return self
 

src/n/o/notabene-HEAD/trunk/lib/rdflib/syntax/NamespaceManager.py   notabene(Download)
from __future__ import generators
 
from rdflib import URIRef, Literal, RDFS, Variable
from rdflib.syntax.xml_names import split_uri
 
from urlparse import urljoin, urldefrag
from urllib import pathname2url, url2pathname
    def absolutize(self, uri, defrag=1):
        base = urljoin("file:", pathname2url(os.getcwd()))
        result = urljoin("%s/" % base, uri, allow_fragments=not defrag)
        if defrag:
            result = urldefrag(result)[0]
        if not defrag:
            if uri and uri[-1]=="#" and result[-1]!="#":

src/s/c/scrapy-HEAD/scrapy/core/downloader/webclient.py   scrapy(Download)
from urlparse import urlparse, urlunparse, urldefrag
 
from twisted.python import failure
from twisted.web.client import PartialDownloadError, HTTPClientFactory
from twisted.web.http import HTTPClient
from twisted.internet import defer
 
    def __init__(self, request, timeout=180):
        self.url = urldefrag(request.url)[0]
        self.method = request.method
        self.body = request.body or None
        self.headers = Headers(request.headers)
        self.response_headers = None
        self.timeout = request.meta.get('download_timeout') or timeout

src/b/a/badger-lib-HEAD/packages/python-openid/openid/consumer/consumer.py   badger-lib(Download)
 
import cgi
import copy
from urlparse import urlparse, urldefrag
 
from openid import fetchers
 
 
        # Fragments do not influence discovery, so we can't compare a
        # claimed identifier with a fragment to discovered information.
        defragged_claimed_id, _ = urldefrag(to_match.claimed_id)
        if defragged_claimed_id != endpoint.claimed_id:
            raise ProtocolError(
                'Claimed ID does not match (different subjects!), '

src/r/d/rdflib-HEAD/rdflib/namespace.py   rdflib(Download)
 
import os
 
from urlparse import urljoin, urldefrag
from urllib import pathname2url
 
from rdflib.term import URIRef
    def absolutize(self, uri, defrag=1):
        base = urljoin("file:", pathname2url(os.getcwd()))
        result = urljoin("%s/" % base, uri, allow_fragments=not defrag)
        if defrag:
            result = urldefrag(result)[0]
        if not defrag:
            if uri and uri[-1]=="#" and result[-1]!="#":

src/p/o/polinax-HEAD/libs/external_libs/python-openid-2.1.1/openid/consumer/consumer.py   polinax(Download)
 
import cgi
import copy
from urlparse import urlparse, urldefrag
 
from openid import fetchers
 
 
        # Fragments do not influence discovery, so we can't compare a
        # claimed identifier with a fragment to discovered information.
        defragged_claimed_id, _ = urldefrag(to_match.claimed_id)
        if defragged_claimed_id != endpoint.claimed_id:
            raise ProtocolError(
                'Claimed ID does not match (different subjects!), '

  1 | 2 | 3  Next