Python six.moves.urllib.parse.ParseResult() Examples
The following are 15
code examples of six.moves.urllib.parse.ParseResult().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
six.moves.urllib.parse
, or try the search function
.
![](https://www.programcreek.com/common/static/images/search.png)
Example #1
Source File: core.py From scales with MIT License | 6 votes |
def Parse(self, uri): parsed = urlparse(uri) # Work around python 2.7.3 not handling # in URIs correctly. if '#' in parsed.path: path, fragment = parsed.path.split('#', 1) parsed = ParseResult( scheme = parsed.scheme, netloc = parsed.netloc, path = path, params = parsed.params, query = parsed.query, fragment = fragment ) handler = self.handlers.get(parsed.scheme.lower(), None) if not handler: raise Exception("No handler found for prefix %s" % parsed.scheme) return handler(parsed)
Example #2
Source File: ncbi.py From hgvs with Apache License 2.0 | 5 votes |
def __new__(cls, pr): return super(ParseResult, cls).__new__(cls, *pr)
Example #3
Source File: ncbi.py From hgvs with Apache License 2.0 | 5 votes |
def _parse_url(db_url): """parse database connection urls into components UTA database connection URLs follow that of SQLAlchemy, except that a schema may be optionally specified after the database. The skeleton format is: driver://user:pass@host/database/schema >>> params = _parse_url("driver://user:pass@host:9876/database/schema") >>> params.scheme u'driver' >>> params.hostname u'host' >>> params.username u'user' >>> params.password u'pass' >>> params.database u'database' >>> params.schema u'schema' """ return ParseResult(urlparse.urlparse(db_url))
Example #4
Source File: uta.py From hgvs with Apache License 2.0 | 5 votes |
def __new__(cls, pr): return super(ParseResult, cls).__new__(cls, *pr)
Example #5
Source File: uta.py From hgvs with Apache License 2.0 | 5 votes |
def _parse_url(db_url): """parse database connection urls into components UTA database connection URLs follow that of SQLAlchemy, except that a schema may be optionally specified after the database. The skeleton format is: driver://user:pass@host/database/schema >>> params = _parse_url("driver://user:pass@host:9876/database/schema") >>> params.scheme u'driver' >>> params.hostname u'host' >>> params.username u'user' >>> params.password u'pass' >>> params.database u'database' >>> params.schema u'schema' """ return ParseResult(urlparse.urlparse(db_url))
Example #6
Source File: test_client.py From networking-odl with Apache License 2.0 | 5 votes |
def setUp(self): super(TestClientHTTPBasicAuth, self).setUp() conf = ceilometer_service.prepare_service(argv=[], config_files=[]) self.CONF = self.useFixture(config_fixture.Config(conf)).conf self.parsed_url = urlparse.urlparse( 'http://127.0.0.1:8080/controller/statistics?' 'auth=%s&user=admin&password=admin_pass&' 'scheme=%s' % (self.auth_way, self.scheme)) self.params = urlparse.parse_qs(self.parsed_url.query) self.endpoint = urlparse.urlunparse( urlparse.ParseResult(self.scheme, self.parsed_url.netloc, self.parsed_url.path, None, None, None)) odl_params = {'auth': self.params.get('auth')[0], 'user': self.params.get('user')[0], 'password': self.params.get('password')[0]} self.client = client.Client(self.CONF, self.endpoint, odl_params) self.resp = mock.MagicMock() self.get = mock.patch('requests.Session.get', return_value=self.resp).start() self.resp.raw.version = 1.1 self.resp.status_code = 200 self.resp.reason = 'OK' self.resp.headers = {} self.resp.content = 'dummy'
Example #7
Source File: abstractJobStore.py From toil with Apache License 2.0 | 5 votes |
def __init__(self, url): """ :param urlparse.ParseResult url: """ super().__init__("The URL '%s' is invalid." % url.geturl())
Example #8
Source File: abstractJobStore.py From toil with Apache License 2.0 | 5 votes |
def _findJobStoreForUrl(self, url, export=False): """ Returns the AbstractJobStore subclass that supports the given URL. :param urlparse.ParseResult url: The given URL :param bool export: The URL for :rtype: toil.jobStore.AbstractJobStore """ for jobStoreCls in self._jobStoreClasses: if jobStoreCls._supportsUrl(url, export): return jobStoreCls raise RuntimeError("No job store implementation supports %sporting for URL '%s'" % ('ex' if export else 'im', url.geturl()))
Example #9
Source File: abstractJobStore.py From toil with Apache License 2.0 | 5 votes |
def _importFile(self, otherCls, url, sharedFileName=None, hardlink=False): """ Import the file at the given URL using the given job store class to retrieve that file. See also :meth:`.importFile`. This method applies a generic approach to importing: it asks the other job store class for a stream and writes that stream as either a regular or a shared file. :param AbstractJobStore otherCls: The concrete subclass of AbstractJobStore that supports reading from the given URL and getting the file size from the URL. :param urlparse.ParseResult url: The location of the file to import. :param str sharedFileName: Optional name to assign to the imported file within the job store :return The jobStoreFileId of imported file or None if sharedFileName was given :rtype: toil.fileStores.FileID or None """ if sharedFileName is None: with self.writeFileStream() as (writable, jobStoreFileID): size = otherCls._readFromUrl(url, writable) return FileID(jobStoreFileID, size) else: self._requireValidSharedFileName(sharedFileName) with self.writeSharedFileStream(sharedFileName) as writable: otherCls._readFromUrl(url, writable) return None
Example #10
Source File: abstractJobStore.py From toil with Apache License 2.0 | 5 votes |
def _exportFile(self, otherCls, jobStoreFileID, url): """ Refer to exportFile docstring for information about this method. :param AbstractJobStore otherCls: The concrete subclass of AbstractJobStore that supports exporting to the given URL. Note that the type annotation here is not completely accurate. This is not an instance, it's a class, but there is no way to reflect that in :pep:`484` type hints. :param str jobStoreFileID: The id of the file that will be exported. :param urlparse.ParseResult url: The parsed URL of the file to export to. """ self._defaultExportFile(otherCls, jobStoreFileID, url)
Example #11
Source File: abstractJobStore.py From toil with Apache License 2.0 | 5 votes |
def _defaultExportFile(self, otherCls, jobStoreFileID, url): """ Refer to exportFile docstring for information about this method. :param AbstractJobStore otherCls: The concrete subclass of AbstractJobStore that supports exporting to the given URL. Note that the type annotation here is not completely accurate. This is not an instance, it's a class, but there is no way to reflect that in :pep:`484` type hints. :param str jobStoreFileID: The id of the file that will be exported. :param urlparse.ParseResult url: The parsed URL of the file to export to. """ with self.readFileStream(jobStoreFileID) as readable: otherCls._writeToUrl(readable, url)
Example #12
Source File: abstractJobStore.py From toil with Apache License 2.0 | 5 votes |
def _readFromUrl(cls, url, writable): """ Reads the contents of the object at the specified location and writes it to the given writable stream. Refer to :func:`~AbstractJobStore.importFile` documentation for currently supported URL schemes. :param urlparse.ParseResult url: URL that points to a file or object in the storage mechanism of a supported URL scheme e.g. a blob in an AWS s3 bucket. :param writable: a writable stream :return int: returns the size of the file in bytes """ raise NotImplementedError()
Example #13
Source File: abstractJobStore.py From toil with Apache License 2.0 | 5 votes |
def _writeToUrl(cls, readable, url): """ Reads the contents of the given readable stream and writes it to the object at the specified location. Refer to AbstractJobStore.importFile documentation for currently supported URL schemes. :param urlparse.ParseResult url: URL that points to a file or object in the storage mechanism of a supported URL scheme e.g. a blob in an AWS s3 bucket. :param readable: a readable stream """ raise NotImplementedError()
Example #14
Source File: abstractJobStore.py From toil with Apache License 2.0 | 5 votes |
def _supportsUrl(cls, url, export=False): """ Returns True if the job store supports the URL's scheme. Refer to AbstractJobStore.importFile documentation for currently supported URL schemes. :param bool export: Determines if the url is supported for exported :param urlparse.ParseResult url: a parsed URL that may be supported :return bool: returns true if the cls supports the URL """ raise NotImplementedError()
Example #15
Source File: test_verifier.py From alexa-skills-kit-sdk-for-python with Apache License 2.0 | 5 votes |
def test_load_cert_chain_invalid_cert_url_throw_exception(self): mocked_parsed_url = mock.MagicMock(spec=ParseResult) with mock.patch( "ask_sdk_webservice_support.verifier.urlparse", return_value=mocked_parsed_url): with self.assertRaises(VerificationException) as exc: self.request_verifier._load_cert_chain(self.MALFORMED_URL) self.assertIn( "Unable to load certificate from URL", str(exc.exception))