TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

A Go “clone” of the great and famous Requests library

92 pointsby agonzalezroalmost 10 years ago

10 comments

spenczar5almost 10 years ago
These ports from Python and Ruby (like Martini, for another example) are well-intentioned, but I don&#x27;t think they&#x27;re a good idea to use. The original libraries get a lot of their expressive power from polymorphism - Requests gets a tremendous amount of mileage out of letting you pass in keyword arguments to the `get` method, for example.<p>Go prefers that you be more explicit and use more function declarations, even if it means repetition in the library code. When developers try to get around this, you see awkward constructs like the pointer-to-a-config-struct used here.
评论 #9784782 未加载
评论 #9784449 未加载
评论 #9785412 未加载
评论 #9785805 未加载
jkldotioalmost 10 years ago
Very poorly named given Requests has a branch using Gevent that&#x27;s already called grequests. <a href="https:&#x2F;&#x2F;github.com&#x2F;kennethreitz&#x2F;grequests" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;kennethreitz&#x2F;grequests</a>
评论 #9784198 未加载
评论 #9784667 未加载
shawnpsalmost 10 years ago
Whenever I&#x27;m reading through Go code and come across something that uses this sort of abstraction library, I usually just close it and move on. The stdlib is really nice and I find code that stays as &quot;vanilla&quot; Go as possible to be the easiest to read.
评论 #9784615 未加载
gghhalmost 10 years ago
forgive my ignorance, is the original library <a href="http:&#x2F;&#x2F;python-requests.org" rel="nofollow">http:&#x2F;&#x2F;python-requests.org</a> ?
评论 #9784054 未加载
评论 #9784270 未加载
评论 #9784063 未加载
评论 #9784056 未加载
评论 #9784673 未加载
tptacekalmost 10 years ago
What&#x27;s a use case in Go for an HTTP request library interface that returns a new channel for each request? There&#x27;s no good way to select on a slice of channels, is there?
评论 #9784493 未加载
评论 #9784486 未加载
fishnchipsalmost 10 years ago
As much as I love to see new things written in Go I am not a big fan of directly porting libraries written in different languages. It&#x27;s not even that they&#x27;re not idiomatic - I can live with that just fine. But the real power of Go comes from interfaces - two great examples being `io.Reader` and `io.Writer`. Once you can structure your library code so that it reasonably implements these standard interfaces you can do complex stuff in a trivial way. Say I want to get a file via HTTP, encrypt it while getting a hash of plaintext and upload it to say Google Cloud. I can pretty trivially do it by putting one `io.Writer` (Google Cloud) in another (encryption) and another (hashing, via `io.MultiWriter`) and then perform the whole thing using a simple `io.Copy`. This sort of expressive power can be achieved iff all libraries you&#x27;re using adhere to the same philosophy - which is not the case with ports.
评论 #9787320 未加载
domrdyalmost 10 years ago
Would be cool if the examples showcased fetching a list of URL&#x27;s in parallel or something else that is a bit more complex.
评论 #9784573 未加载
iqandjokealmost 10 years ago
After reading <a href="https:&#x2F;&#x2F;github.com&#x2F;mozillazg&#x2F;request" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mozillazg&#x2F;request</a>, I found yours looks a little bit better.
评论 #9784532 未加载
hobarreraalmost 10 years ago
Until go fixes it&#x27;s issues with IPv6 (noticeably: it won&#x27;t work on IPv6 out-of-the-box), I can&#x27;t really respect it or consider it &quot;production ready&quot; for anything network related.<p>No, I&#x27;m not trolling. #8453 got closed, and immediately, #11081 was opened since it re-broke this.<p>Original issue reported by myself: <a href="https:&#x2F;&#x2F;github.com&#x2F;golang&#x2F;go&#x2F;issues&#x2F;8124" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;golang&#x2F;go&#x2F;issues&#x2F;8124</a>
nlake44almost 10 years ago
Go is great, its open source. I wish Hacker News open sourced their code so that we knew what they are doing. Scared of having folks game the system? Why not have the community make it the best algorithm possible. Why keep pushing YC all the time? Do they not have enough already? Painters and hackers! ha!
评论 #9784796 未加载