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, ''
def url_query_cleaner(url, parameterlist=(), sep='&', kvsep='=', remove=False, unique=True):
"""Clean url arguments leaving only those passed in the parameterlist keeping order
If remove is True, leave only those not in parameterlist.
If unique is False, do not remove duplicated keys
"""
url = urlparse.urldefrag(url)[0]
src/s/a/sage-HEAD/trunk/local/lib/python2.4/site-packages/ZConfig/url.py sage(Download)
def urldefrag(url):
url, fragment = _urlparse.urldefrag(url)
return urlnormalize(url), fragment
def urljoin(base, relurl):
url = _urlparse.urljoin(base, relurl)
src/s/a/sage-HEAD/local/lib/python2.4/site-packages/ZConfig/url.py sage(Download)
def urldefrag(url):
url, fragment = _urlparse.urldefrag(url)
return urlnormalize(url), fragment
def urljoin(base, relurl):
url = _urlparse.urljoin(base, relurl)
src/s/c/Scrapy-0.10.3/scrapy/utils/url.py Scrapy(Download)
def url_query_cleaner(url, parameterlist=(), sep='&', kvsep='=', remove=False, unique=True):
"""Clean url arguments leaving only those passed in the parameterlist keeping order
If remove is True, leave only those not in parameterlist.
If unique is False, do not remove duplicated keys
"""
url = urlparse.urldefrag(url)[0]
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/z/p/zpkg-1.0.0/Dependencies/ZConfig-zpkg-1.0.0/ZConfig/url.py zpkg(Download)
def urldefrag(url):
url, fragment = _urlparse.urldefrag(url)
return urlnormalize(url), fragment
def urljoin(base, relurl):
url = _urlparse.urljoin(base, relurl)
src/z/p/zpkg-1.0.0/Support/ZConfig/url.py zpkg(Download)
def urldefrag(url):
url, fragment = _urlparse.urldefrag(url)
return urlnormalize(url), fragment
def urljoin(base, relurl):
url = _urlparse.urljoin(base, relurl)
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/z/c/ZConfig-2.8.0/ZConfig/url.py ZConfig(Download)
def urldefrag(url):
url, fragment = _urlparse.urldefrag(url)
return urlnormalize(url), fragment
def urljoin(base, relurl):
url = _urlparse.urljoin(base, relurl)
1 | 2 | 3 | 4 | 5 Next