uri.jsvshttptools
URI.js is a lightweight JavaScript library for working with URLs and URIs in Node.js and the browser. It provides a simple and consistent interface for parsing, manipulating, and building URLs and URIs.
httptools is a package for parsing and modifying HTTP protocol strings which supports HTTP1.1 and HTTP2 protocol versions.
httptools is a Python binding for the nodejs HTTP parser. The package is available on PyPI: pip install httptools
Example Use
const URI = require('uri-js');
// parse url for values
const parsedUrl = URI.parse("https://www.example.com/search?q=query+string#fragment");
console.log(parsedUrl);
/* Output:
{
scheme: 'https',
authority: 'www.example.com',
path: '/search',
query: 'q=query+string',
fragment: 'fragment'
}
*/
// create url from values
const urlComponents = {
scheme: 'https',
authority: 'www.example.com',
path: '/search',
query: 'q=query+string',
fragment: 'fragment'
};
const url = URI.serialize(urlComponents);
console.log(url);
// Output: 'https://www.example.com/search?q=query+string#fragment'