Your input is encoded double. Using Python 3:
urllib.parse.unquote(urllib.parse.unquote(some_string))
Output:
'FireShot3+(2).png'
now you have the + left.
Edit:
Using Python 2.7, it would need to be:
urllib.unquote(urllib.unquote('FireShot3%2B%25282%2529.png'))
Answer from user1907906 on Stack OverflowElifulkerson
elifulkerson.com › projects › python-double-urlencode.php
Python Double URL-encode
This function also serves as a url_encode function that is more similar to other languages, omitting the 'variablename=' portion of the output. from urllib import urlencode def testcase(text, result): """Test to see if the double_urlencode function's output for an input of 'text' matches 'result'.""" text = double_urlencode(text) if (result != text): print "Error: double_urlencode testcase failure :(" # Pretty up the problem for debugging purposes print text print result buf = "" for i in range(0, len(result)): try: if text[i] == result[i]: buf += " " else: buf += "^" except IndexError: buf += "*" print buf def double_urlencode(text): """double URL-encode a given 'text'.
Top answer 1 of 2
31
Your input is encoded double. Using Python 3:
urllib.parse.unquote(urllib.parse.unquote(some_string))
Output:
'FireShot3+(2).png'
now you have the + left.
Edit:
Using Python 2.7, it would need to be:
urllib.unquote(urllib.unquote('FireShot3%2B%25282%2529.png'))
2 of 2
10
urllib.unquote_plus(urllib.unquote_plus(some_string))
FireShot3 (2).png
[BUG][python-experimental] double URL encoding of path parameters?
Bug Report Checklist Have you provided a full/minimal spec to reproduce the issue? Have you validated the input using an OpenAPI validator (example)? Have you tested with the latest master to confi... More on github.com
Encode url including slashes?
urllib.parse.quote_plus is what you want. More on reddit.com
Double encoding url rejection
It's possible the urlencoding/requests package behave differently on python3. Today my requests to firebase began to be rejected for double-quoting of the query string. I guess this is a change on their end which is why I bring it up here. ... you can see the " is encoded to " and then to %22. More on github.com
%2e Being Decoded in URL
Hi there, When a url-encoded period is included in a url (in path directory, path file, param name, or param value), it gets permanently converted to a period before the request is made (sometime b... More on github.com
Videos
10:05
This Simple URL Encoding Made me $50,000 in Bounties - YouTube
15:31
What is URL Encoding? - URL Encode/Decode Explained - Web Development ...
02:41
URL Encoding in a few minutes - YouTube
- YouTube
10:16
Using Double URL Encoding to Bypass Security Mechanisms for a ...
03:56
XSS double url encoded filter evasion - YouTube
URL Encoder
urlencoder.io › python
How to encode URLs in Python | URLEncoder
In Python 3+, You can URL encode any string using the quote() function provided by urllib.parse package.
GitHub
github.com › OpenAPITools › openapi-generator › issues › 12227
[BUG][python-experimental] double URL encoding of path parameters? · Issue #12227 · OpenAPITools/openapi-generator
April 24, 2022 - The URL parameter seems to be encoded twice. ... send: b'GET /api/v1/coffees/label/Pinheirense%20Natural HTTP/1.1\r\nHost: localhost:62602\r\nAccept-Encoding: identity\r\nAccept: application/json; charset=utf-8\r\nUser-Agent: OpenAPI-Generator/0.0.1/python\r\nAuthorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1YjExMjdiZjE2NmU2MDI3MjU3M2ExYjAiLCJpYXQiOjE2NTA4MjUyMzIsImV4cCI6MTY1MDkxMTYzMn0.BrBK7WHoezBee2yuahSr5N8jJ-fJ1WyoaLN7_rDEoeo\r\nAuthorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1YjExMjdiZjE2NmU2MDI3MjU3M2ExYjAiLCJpYXQiOjE2NTA4MjUyMzIsImV4cCI6MTY1MDk
Author OpenAPITools
Reddit
reddit.com › r/learnpython › encode url including slashes?
r/learnpython on Reddit: Encode url including slashes?
October 1, 2022 -
Hello i would like to encode an url like this:
http://www.foodserv.co.za
I tried it with the following code
import urllib link = urllib.parse.quote(link) print(link)
But with that i only get: http%3A//www.foodserv.co.za
But i would like to have also the // encoded and in the end i should look like this: http%3A%2F%2Fwww.foodserv.co.za
Is there some other way or parameter to encode the url like i need it?
Top answer 1 of 3
3
urllib.parse.quote_plus is what you want.
2 of 3
1
Hello, I'm a Reddit bot who's here to help people nicely format their coding questions. This makes it as easy as possible for people to read your post and help you. I think I have detected some formatting issues with your submission: Python code found in submission text that's not formatted as code. Use of triple backtick/ curlywhirly code blocks (``` or ~~~). These may not render correctly on all Reddit clients. If I am correct, please edit the text in your post and try to follow these instructions to fix up your post's formatting. Am I misbehaving? Have a comment or suggestion? Reply to this comment or raise an issue here .
Devzery
devzery.com › post › urlencode-python-mastering-url-encoding-in-python
Python URL Encoding Made Simple: Learn urlencode, Query Strings & API Handling!
April 21, 2025 - Use Libraries that Handle Encoding ... risk of double encoding. Always test your encoded URLs to ensure they work as expected: Use Online Tools: Online tools can help validate the correctness of your encoded URLs. Automated Tests: Implement automated tests in your development pipeline to check for encoding issues. The urllib.parse module is the go-to solution for URL encoding and decoding in Python...
Linux Hint
linuxhint.com › urlencode-python
How to urlencode in Python? – Linux Hint
Then we have used the “quote” function utilizing parse class and “urllib” to encode the variable “str” value and save it into a new variable, “new.” On the fifth line, we have printed the encoded string “new.” · #!/usr/bin/python import urllib.parse str = "HY!
Python
docs.python.org › 3 › library › urllib.parse.html
urllib.parse — Parse URLs into components — Python 3.14.6 ...
Parse a query string given as a string argument (data of type application/x-www-form-urlencoded). Data are returned as a dictionary. The dictionary keys are the unique query variable names and the values are lists of values for each name. The optional argument keep_blank_values is a flag indicating whether blank values in percent-encoded queries should be treated as blank strings.
URLDecoder
urldecoder.io › python
URL Decoding query strings or form parameters in Python | URLDecoder
>>> import urllib >>> queryStr = 'Hellö+Wörld@Python' >>> urllib.unquote_plus(queryStr) 'Hell\xc3\xb6 W\xc3\xb6rld@Python' ... Use our free online tool to decode any URL encoded string back to its normal form.
GitHub
github.com › thisbejim › Pyrebase › issues › 294
Double encoding url rejection · Issue #294 · thisbejim/Pyrebase
February 15, 2019 - It's possible the urlencoding/requests package behave differently on python3. Today my requests to firebase began to be rejected for double-quoting of the query string. I guess this is a change on their end which is why I bring it up here. ... you can see the " is encoded to " and then to %22.
Author thisbejim
iO Flood
ioflood.com › blog › python-url-encode
[SOLVED] Python URL Encode Using urllib.parse Functions
February 1, 2024 - These include using third-party libraries that offer more features or a different way of handling URL encoding. One such library is requests, which is a popular choice for making HTTP requests in Python. It comes with a built-in method for URL encoding, requests.utils.requote_uri().
GitHub
github.com › psf › requests › issues › 3077
. Being Decoded in URL · Issue #3077 · psf/requests
April 6, 2016 - requests.get('http://www.example.com/', params=dict(a='x.y')).url Output: u'http://www.example.com/?a=x%2ey' First Line of Request When Viewing Through Proxy: GET /?a=x%2ey HTTP/1.1
Author psf
GitHub
github.com › psf › requests › issues › 2119
Get parameters are being double encoded · Issue #2119 · psf/requests
July 4, 2014 - parameters are being double encoded. I have the following code: url = 'http://example.com' queryParameters = {"MenuRequest": '{"language":"en-us","storeName":"R10501","datetime":"00:00:00","tenant":"store1"}'} and I pass it in like such: response = requests.get(url, params = queryParameters, verify=False) the result is this: http://example.com/?MenuRequest=%7B%22language%22%3A%22en-us%22%2C%22storeName%22%3A%22R10501%22%2C%22datetime%22%3A%2200%3A00%3A00%22%2C%22tenant%22%3A%22store1%22%7D ·
Author psf