103 def makeHTTPRequest(self, fetchType, httpParams):
105 self.isResourceNotChanged =
False 106 if self.modifiedSettings
is not None:
110 if httpParams
is None:
113 self.headersClearing(httpParams)
116 if self.modifiedSettings[
"algorithm"] == self.ALGO_AUTO:
117 if self.eTags
is not None and self.eTags
is not "":
118 eTagsString = self.generateETagsString(self.eTags)
119 httpParams[
"httpHeader"][
"if-none-match"] = eTagsString
121 if self.lastModified
is not None:
122 httpParams[
"httpHeader"][
"if-modified-since"] = self.lastModified
124 elif self.modifiedSettings[
"algorithm"] == self.ALGO_IF_NOT_MATCH:
125 if self.eTags
is not None and self.eTags
is not "":
126 eTagsString = self.generateETagsString(self.eTags)
127 httpParams[
"httpHeader"][
"if-none-match"] = eTagsString
129 elif self.modifiedSettings[
"algorithm"] == self.ALGO_IF_MOFIFIED_SINCE:
130 if self.lastModified
is not None:
131 httpParams[
"httpHeader"][
"if-modified-since"] = self.lastModified
133 elif self.modifiedSettings[
"algorithm"] == self.ALGO_HEAD:
134 if self.modifiedSettings[
"mode"] == self.MODE_ONE_REQUEST:
135 raise Exception(
">>> Error [algorithm == 3 and mode == 1] not compatible !!!")
138 ret = BaseFetcher.get_fetcher(fetchType).open(httpParams[
"url"],
139 timeout=httpParams[
"httpTimeout"],
140 headers=httpParams[
"httpHeader"],
141 allow_redirects=httpParams[
"allowHttpRedirects"],
142 proxies=httpParams[
"proxies"], auth=httpParams[
"auth"],
143 data=httpParams[
"postData"], log=logger,
144 allowed_content_types=httpParams[
"processContentTypes"],
145 max_resource_size=httpParams[
"maxResourceSize"],
146 max_redirects=httpParams[
"maxHttpRedirects"],
150 self.resourceComparing(ret)
151 if not self.isResourceNotChanged
and self.modifiedSettings[
"mode"] == self.MODE_TWO_REQUESTS:
152 self.headersClearing(httpParams)
153 ret = BaseFetcher.get_fetcher(fetchType).open(httpParams[
"url"],
154 timeout=httpParams[
"httpTimeout"],
155 headers=httpParams[
"httpHeader"],
156 allow_redirects=httpParams[
"allowHttpRedirects"],
157 proxies=httpParams[
"proxies"], auth=httpParams[
"auth"],
158 data=httpParams[
"postData"], log=logger,
159 allowed_content_types=httpParams[
"processContentTypes"],
160 max_resource_size=httpParams[
"maxResourceSize"],
161 max_redirects=httpParams[
"maxHttpRedirects"])