Documentation
¶
Overview ¶
Package request implements request entity contains url and other relevant informaion.
Index ¶
- type Request
- func NewRequest(url string, respType string, urltag string, method string, postdata string, ...) *Request
- func NewRequestWithHeaderFile(url string, respType string, headerFile string) *Request
- func NewRequestWithProxy(url string, respType string, urltag string, method string, postdata string, ...) *Request
- func (this *Request) AddHeaderFile(headerFile string) *Request
- func (this *Request) AddProxyHost(host string) *Request
- func (this *Request) GetCookies() []*http.Cookie
- func (this *Request) GetHeader() http.Header
- func (this *Request) GetMeta() interface{}
- func (this *Request) GetMethod() string
- func (this *Request) GetPostdata() string
- func (this *Request) GetProxyHost() string
- func (this *Request) GetRedirectFunc() func(req *http.Request, via []*http.Request) error
- func (this *Request) GetResponceType() string
- func (this *Request) GetUrl() string
- func (this *Request) GetUrlTag() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Request ¶
type Request struct {
Url string
// Responce type: html json jsonp text
RespType string
// GET POST
Method string
// POST data
Postdata string
// name for marking url and distinguish different urls in PageProcesser and Pipeline
Urltag string
// http header
Header http.Header
// http cookies
Cookies []*http.Cookie
//proxy host example='localhost:80'
ProxyHost string
Meta interface{}
// contains filtered or unexported fields
}
Request represents object waiting for being crawled.
func NewRequest ¶
func NewRequestWithProxy ¶
func (*Request) AddHeaderFile ¶
point to a json file
xxx.json
{
"User-Agent":"curl/7.19.3 (i386-pc-win32) libcurl/7.19.3 OpenSSL/1.0.0d",
"Referer":"http://weixin.sogou.com/gzh?openid=oIWsFt6Sb7aZmuI98AU7IXlbjJps",
"Cookie":""
}
func (*Request) AddProxyHost ¶
@host http://localhost:8765/
func (*Request) GetCookies ¶
func (*Request) GetPostdata ¶
func (*Request) GetProxyHost ¶
func (*Request) GetRedirectFunc ¶
func (*Request) GetResponceType ¶
Click to show internal directories.
Click to hide internal directories.