spulec / uncurl

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

The example from the doc does not work #43

Closed YAmikep closed 3 years ago

YAmikep commented 3 years ago

The example from the doc does not work. Any idea why?

In [12]: import uncurl

In [13]: uncurl "curl 'https://pypi.python.org/pypi/uncurl' -H 'Accept-Encoding: gzip,deflate,sdch' -H 'Accept-Language: en-US,en;q=0.8' -H 'User-Agent: Mozilla
    ...: /5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.152 Safari/537.36' -H 'Accept: text/html,application/xh
    ...: tml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Cache-Control: max-age=0' -H 'Cookie: foo=bar;' -H 'Connection: keep-alive' --compressed"
  File "<ipython-input-13-018c847865b1>", line 1
    uncurl "curl 'https://pypi.python.org/pypi/uncurl' -H 'Accept-Encoding: gzip,deflate,sdch' -H 'Accept-Language: en-US,en;q=0.8' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.152 Safari/537.36' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Cache-Control: max-age=0' -H 'Cookie: foo=bar;' -H 'Connection: keep-alive' --compressed"
           ^
SyntaxError: invalid syntax

uncurl==0.0.10 Python 3.9.1

YAmikep commented 3 years ago

Nevermind, I realized that's not how to use it from python but from the shell.. 🤦