curlconverter / curlconverter

Transpile curl commands into Python, JavaScript and 27 other languages
https://curlconverter.com
MIT License
7.21k stars 876 forks source link

Availability through PyCharm #322

Closed michaeletro closed 2 years ago

michaeletro commented 2 years ago

It would be great if this was available through PyCharm. Having trouble downloading the package and love the website emulator

verhovsky commented 2 years ago

Could you share exactly what you're having trouble with when downloading the package?

I agree, this definitely needs to be packaged as an extension. I'll make one for VS Code.

michaeletro commented 2 years ago

I appreciate your timely response!

So I have a couple of questions, is this package strictly for JavaScript? I am tinkering with automating CURL requests with Python and love how your web page filters and sorts through the Raw CURL request so elegantly. It would be superb if a library for Python to work with your code. Secondly, do we need permission to pull from the source code? I am getting an error message stating I need to request permission to pull.

Nonetheless, your work here is pretty excellent. I have been tinkering with alternative solutions to retrieving, filtering, classifying, and automating CURL requests, and your page is a blessing.

On Fri, Jan 7, 2022 at 4:44 AM Boris Verkhovskiy @.***> wrote:

Could you share exactly what you're having trouble with when downloading the package?

I agree, this definitely needs to be packaged as an extension. I'll make one for VS Code.

— Reply to this email directly, view it on GitHub https://github.com/curlconverter/curlconverter/issues/322#issuecomment-1007270044, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG2COKT7HTY4HCJWRRWS4C3UU2YYZANCNFSM5LOKSUVQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

verhovsky commented 2 years ago

curlconverter can be used from the command line, not just JavaScript. It also has a JSON output, which outputs a representation of the input command after the first step of parsing.

You can call the command line tool from Python through subprocess and pipe your input command like this

import subprocess
import json

def parse_curl(command):
    result = subprocess.run(['curlconverter', '--language', 'json', '-'], text=True, input=command, capture_output=True)
    return json.loads(result.stdout)

print(parse_curl("curl --data helloworld example.com"))  # {'url': 'http://example.com', 'raw_url': 'http://example.com', 'method': 'post', 'data': {'helloworld': ''}}

Note that you'll need to install the preview version of curlconverter for the new command line interface, which you can do with

npm install -g curlconverter@next

http://curlconverter.com/ also links to other projects that try to do the same thing. There is a Python uncurl library, but I've never used it.

am getting an error message stating I need to request permission to pull

if I understood correctly, I bet it's because you're pulling (cloning) over SSH and don't have an SSH key configured for github. The fastest thing would be to use HTTP:

Screen Shot 2022-01-07 at 3 51 19 AM

i.e.

git clone https://github.com/curlconverter/curlconverter.git
verhovsky commented 2 years ago

I created the VS Code extension: https://github.com/curlconverter/curlconverter/issues/147#issuecomment-1008482048

michaeletro commented 2 years ago

Excellent!

Your code snippet ended up working haha but in my frustration I ended up writing a filtering algorithm to filter a raw CURL text into headers, cookies, data etc. based off of their set haha so I am parsing networking requests pretty efficiently.

My next step is to be able to retrieve individual JSON variables to replace them with my own inputs and use the same network requests to extract different data points with my inputted variables.

I might be reinventing the wheel, but it is still an interesting project to work on.

I will check out your VS Code extension! Your website does it pretty amazingly! Thank you for your support as well.

On Tue, Jan 11, 2022 at 1:47 PM Boris Verkhovskiy @.***> wrote:

I created the VS Code extension: #147 (comment) https://github.com/curlconverter/curlconverter/issues/147#issuecomment-1008482048

— Reply to this email directly, view it on GitHub https://github.com/curlconverter/curlconverter/issues/322#issuecomment-1010259040, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG2COKW6YD7WBF4GMVFAPC3UVR3NTANCNFSM5LOKSUVQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

verhovsky commented 2 years ago

I'm closing this as wontfix because there's a VS Code extension now and I'm not going to work on a PyCharm extension.

If someone wants to make one, they obviously can.