Comments (5)
Hey Jordan,
NewDocument is just a helper func that uses the net/http default client (via http.Get), so whatever timeout you set on the default client (via its underlying transport) will be used. If you don't want to change the default client so that it doesn't interfere with other uses, then you can create your own http client, and pass the response to NewDocumentFromResponse instead.
from goquery.
Thanks! Looks like there isn't a very straightforward way at adding timeouts to Go's default client, does goquery support go-httpclient? Looks like this is a thin wrapper around the default but with timeout supported.
from goquery.
Yeah, setting timeouts is not super straightforward, you can see some options here: http://stackoverflow.com/questions/16895294/how-to-set-timeout-for-http-get-requests-in-golang
Goquery does not support other http clients, but there is a constructor based on an *http.Response (if this client returns stdlib's responses), or based on an io.Reader, so you should be able to get a goquery.Document one way or another.
from goquery.
Thanks Martin! That helped a lot and I have this up and working in production. Since go-httpclient returns the native http.Response I was able to use its timeout functionality and pass the response into goquery. Thanks for making such a flexible library!
from goquery.
Awesome, thanks for the kind words! Best of luck with your project!
from goquery.
Related Issues (20)
- dealing with profiles in script tags. HOT 3
- Selection `Next` method continuously returns new selection even if there are no `html.nodes` left HOT 2
- Get Contents items on first level of container HOT 1
- How to achieve the effect of BeautifulSoup get_text? HOT 5
- GoQuery using up excess memory HOT 2
- BUG: Attr func can not get data if attr data have " Symbols HOT 1
- can't find nodes!
- QueryParams in links are encoded incorrectly HOT 1
- GoQuery Not Matching Element HOT 2
- How to count the number of words before and after a selection across a document? HOT 2
- If an id attribute contains dots tag will not be found HOT 2
- Find(selector)??????
- I am sorry, i can't find. May be some error. HOT 1
- Cant parse <tr> without <table> element. HOT 2
- how to get text 'CZ/KHN' HOT 3
- :first :first-child test failed,the expected nodes are not filtered out HOT 1
- Good
- How to query a shadow DOM? HOT 3
- Add a generic form of `Selection.Map` (requiring a more recent Go version) HOT 4
- Question about parsing nested tables and finding outer elements HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from goquery.