A utility to replace query parameters in URLs
Project description
qsreplace
qsreplace
is a Python utility to replace query parameters in URLs.
Installation
You can install qsreplace
using pip:
pip install qsreplace
Usage
After installing qsreplace
, you can use it in your Python scripts. Here's how you can use the qsreplace
function:
from qsreplace import qsreplace
# Example usage
url_lst = ["https://example.com", "https://example.com/?param=value"]
payloads = ["new_value", "another_value"]
replaced_urls = qsreplace(url_lst, payloads, edit_base_url=True)
for url in replaced_urls:
print(url)
Result:
https://example.com/new_value
https://example.com/another_value
https://example.com/?param=new_value
https://example.com/?param=another_value
In the example above:
url_lst
should contain a list of URLspayloads
is a list of values that will replace query parameters in the URLs Listedit_base_url
tells qsreplace whether or not to append payload to base urls i.e. which doesn't contain any parameters in it.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
qsreplace-0.0.3.post1.tar.gz
(6.1 kB
view hashes)
Built Distribution
Close
Hashes for qsreplace-0.0.3.post1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | abc8a93ae36dba2efffdd32618018a9eabd976904008d90a01aa445da1c78783 |
|
MD5 | 9e01c4da98f73c0f670a14ca577d69c7 |
|
BLAKE2b-256 | 928cb8ecb651a8c1e0386e79a04631af8d718f8a0058339b1b94391a4efcbb80 |