spulec / uncurl

A library to convert curl requests to python-requests.
Apache License 2.0
615 stars 96 forks source link

Does not recognize --data-binary or --compressed #40

Open mglass222 opened 4 years ago

mglass222 commented 4 years ago

Tried both copy as curl-bash and copy as curl-cmd (working on windows machine here, ananconda 3)

Here is the call:

uncurl "curl 'https://www.bestbuy.com/cart/api/v1/addToCart' \ -H 'authority: www.bestbuy.com' \ -H 'accept: application/json' \ -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36' \ -H 'content-type: application/json; charset=UTF-8' \ -H 'origin: https://www.bestbuy.com' \ -H 'sec-fetch-site: same-origin' \ -H 'sec-fetch-mode: cors' \ -H 'sec-fetch-dest: empty' \ -H 'referer: https://www.bestbuy.com/site/evga-ko-ultra-gaming-nvidia-geforce-rtx-2060-6gb-gddr6-pci-express-3-0-graphics-card-black-gray/6403801.p?skuId=6403801' \ -H 'accept-language: en-US,en;q=0.9' \ -H 'cookie: redacted' \ --data-binary '{"items":[{"skuId":"6403801"}]}' \ --compressed"

File "", line 13 --data-binary '{"items":[{"skuId":"6403801"}]}' \

^ SyntaxError: invalid syntax

spulec commented 4 years ago

Hmmm, that works for me.

Can you let me know which version of uncurl, python, and your OS? If you have a full stacktrace, that would be helpful too.

mglass222 commented 4 years ago

Here's a screenshot:

uncurl

mglass222 commented 4 years ago

Windows 10, Anaconda 3, Jupyter Notebook

spulec commented 4 years ago

What version of uncurl?

mglass222 commented 4 years ago

Version: 0.0.10

NoahCardoza commented 4 years ago

I'm having the same problem ☹️

spulec commented 4 years ago

I took another look at your screenshot. It looks like you are trying to use this in Python vs on the command line?

If so, here is the API you want to use:

import uncurl

print(uncurl.parse("curl 'https://pypi.python.org/pypi/uncurl' -H 'Accept-Encoding: gzip,deflate,sdch'"))

Note that for anything inside of the data-binary, you will want to use proper string escaping if you have quotes inside of your quotes (or use triple quotes on the entire string).