Something like httparty for Ruby
don't know maybe i'm new in python, i know ruby)but i need some toolset for python nowurllib is standard lib?is there more complex and friendly libs?
AnimalCode
2009-11-24 06:16:15
Well we're on even footing, I don't know what httparty offers. urllib is standard with Python (as well as its companion urllib2, which have been merged together in Python 3). Perhaps you could explain what you're looking for exactly.
Greg Hewgill
2009-11-24 06:18:38
i don't like this statementparams = urllib.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0})every time to pack, of course i can write wrapper, but!! i search for lib that make me happy, i mean without making more and more code to do simple things
AnimalCode
2009-11-24 06:21:12
i'm crazy at the interface part, what for make this: resp, content = h.request("http://example.org/", "GET")if all we do it's request like get, post, mb it muts be like that: h.get( url ) or g.post( url, data ), than i understand it, sorr but its crazy me sometimes
AnimalCode
2009-11-24 06:27:59
what's wrong with `urllib` then? `resp = urllib.urlopen(url)` seems simple enough if you just want to do GET, and `resp = urllib.urlopen(url, data)` for POST requests. You want "more complex and more friendly" all at once?
mhawke
2009-11-24 06:42:16
i have it "more friendly" in ruby, i search something in python for work, i stay at mechanize lib or u can get me alternative, i don't believe that it's onlyt 2-3 libs in python for http
AnimalCode
2009-11-24 06:44:58
Based on the requirements that you've now added as a comment to your question (btw you should move those comments into the question) httplib2 seems the best match that I know of. If you don't like it, write a wrapper to rubify the interface, or don't use it at all.
mhawke
2009-11-24 07:16:30
For httplib2, you can make it easier, `_, content = h.request('example.org')` will do a GET request by default and put the output in `content`. If it is too complex, you can EASILY write a wrapper around httplib2, so that myH.get(url) calls h.request(url) and myH.post(url, data) calls h.request(url, 'POST', data).
John Paulett
2009-11-24 19:29:49