Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: HTTPLang – a scripting language for making HTTP requests (github.com/max00355)
44 points by max0563 on May 25, 2015 | hide | past | favorite | 8 comments



Just a side note, you pushed pyc files into the repo. .gitignore would be useful there. Otherwise, I don't really see what's wrong or "hard" with requests and how is that better, could you elaborate on that point?


I thought the same thing. The README says:

> I find the process to be stupidly complicated, and handling cookies is a nightmare.

However this is about as straightforward as it can get with Requests. This is the HTTPLang example:

    set URL http://somesite.com
    set POSTDATA username=myUsername,password=myPassword is this
    do POST /login
    set COOKIE $TMPCOOKIE
    do GET /usercp
Here is the equivalent in Python using Requests:

    import requests

    url = "http://example.com"
    post_data = { "username": "myUsername", "password": "myPassword is this" }
    response = requests.post(url + "/login", data=post_data)
    cookies = response.cookies
    requests.get(url + "/usercp", cookies=cookies)
Where's the stupidly complicated nightmare?

The only complicated things I see above are in the HTTPLang version: a variable called "URL" that isn't actually the URL that is being requested, and I guessed at how the cookie functionality worked because it's not at all obvious – I'm assuming that `set COOKIE $TMPCOOKIE` gets the cookie from the previous request and sets it for the subsequent requests.


Besides that, I feel like I'm writing plain HTTP, which is something I really don't want to do or have to think about.


Not to mention curl is also already very simple.



I don't see the improvement over something like HTTPie (https://github.com/jakubroztocil/httpie).


I like DSLs. Good work. Of course, there will be a lot of things to improve, but kudos on the idea and the execution.


OP, have you looked into Robo Browser? I think it does same thing as your project

https://github.com/jmcarp/robobrowser




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: