Re:Show HN: HTTPLang – a scripting language for making HTTP ...
by harel on Monday May 25, 2015 @06:12AM
(#9599368)
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?
[ Parent
| on HN ]
Re:Show HN: HTTPLang – a scripting language for making HTTP ...
by JimDabell on Monday May 25, 2015 @06:46AM
(#9599455)
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.
Re:Show HN: HTTPLang – a scripting language for making HTTP ...
by daenney on Monday May 25, 2015 @08:08AM
(#9599707)
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.
Re:Show HN: HTTPLang – a scripting language for making HTTP ...
by harel on Monday May 25, 2015 @07:13AM
(#9599523)
Not to mention curl is also already very simple.