Skip to main content

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, url_encode=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 URLs
  • payloads is a list of values that will replace query parameters in the URLs List
  • edit_base_url tells qsreplace whether or not to append payload to base urls i.e. which doesn't contain any parameters in it.
  • url_encode defines whether it should encode the generated urls or not

Project details


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.4.post1.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qsreplace-0.0.4.post1-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file qsreplace-0.0.4.post1.tar.gz.

File metadata

  • Download URL: qsreplace-0.0.4.post1.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.9

File hashes

Hashes for qsreplace-0.0.4.post1.tar.gz
Algorithm Hash digest
SHA256 e44197e7fbc48860911b4ebe4e31dac31aaacdf16131b807fb3ffd4cb6eb367b
MD5 e972f937790a0898500f2f5ed4a226dc
BLAKE2b-256 ac48a66b930a5e5cf2fa798cc28182343dd56943f0fb4ec39a04624b0bb72e1e

See more details on using hashes here.

File details

Details for the file qsreplace-0.0.4.post1-py3-none-any.whl.

File metadata

File hashes

Hashes for qsreplace-0.0.4.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 8a8b71a2a0c233a995974181d1e737d4c2d07c8c00a24dc8be301ffaf0cdc8c0
MD5 f0101ea8d7a3e8a78a60df31c0440cb1
BLAKE2b-256 d1033b7aa1c098e79ebef3794806d73f31657516163df517afe45533d3a46fd0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page