Comments (2)
If you're talking about Python, this is intentional. If we change your command to
curl 'http://localhost:8888?resolution=1600900'
Then we can see what data it sends by running a simple netcat server with
nc -kl 8888
The curl command sends this data
GET /?resolution=1600*900 HTTP/1.1
Host: localhost:8888
User-Agent: curl/8.4.0
Accept: */*
The generated Python code for that command is
import requests
response = requests.get('http://localhost:8888?resolution=1600*900')
Which is correct because it sends the same query string
GET /?resolution=1600*900 HTTP/1.1
Host: localhost:8888
User-Agent: python-requests/2.31.0
Accept-Encoding: gzip, deflate
Accept: */*
Connection: keep-alive
If you're saying it should generate this code instead
import requests
params = {
'resolution': '1600*900',
}
response = requests.get('http://localhost:8888', params=params)
then that wouldn't be correct because Requests does percent-encoding in that case and sends this data:
GET /?resolution=1600%2A900 HTTP/1.1
copying as curl from chrome, some characters aren't properly encoded
Is this really true? The browser is sending resolution=1600%2A900
but when you copy as curl it generates a command that sends resolution=1600*900
? That would be an issue to fix in "Copy as cURL".
from curlconverter.
def uhhh(url):
parse_result = urlparse(url)
dict_result = parse_qs(parse_result.query, keep_blank_values=True)
for key in dict_result:
dict_result[key] = dict_result[key][0]
pp = pprint.PrettyPrinter(indent=4, sort_dicts=False)
pp.pprint(dict_result)
anyways, here's a python code for generating that query params manually
might help if someone finds this issue...
from curlconverter.
Related Issues (20)
- Curl Convert - Catarse HOT 1
- curlconverter by default consider server root path for 'tree-sitter-bash.wasm' file HOT 3
- For curl to json conversion, the xml type data seems to be coming in key value pairs HOT 3
- Go + Colly/v2
- npm module cannot convert to json correctly HOT 3
- curlConverter for React HOT 1
- Unnecessary decoding of UTF-8 in Swift (and possibly others)
- Unable to install in the Python 3.12 HOT 1
- add support for --proxy
- convert HOT 1
- [r] require-vs-library HOT 1
- Added Chrome Extension HOT 1
- As Library Usage Error - Next JS Server Side HOT 2
- Issue with curlconverter dependencies HOT 1
- stand alone library? HOT 6
- Error: Error relocating /app/node_modules/tree-sitter/build/Release/tree_sitter_runtime_binding.node: _ZN2v86Object16SetInternalFieldEiNS_5LocalINS_4DataEEE: symbol not found`
- Is there a way to pass locateFile fn on Parser.init HOT 2
- Vite and WASM files HOT 15
- curl convert to json error HOT 1
- aria2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from curlconverter.