MCPcopy Index your code
hub / github.com/pyload/pyload / load

Method load

module/network/HTTPRequest.py:204–241  ·  view source on GitHub ↗

load and returns a given page

(self, url, get={}, post={}, referer=True, cookies=True, just_header=False, multipart=False, decode=False)

Source from the content-addressed store, hash-verified

202
203
204 def load(self, url, get={}, post={}, referer=True, cookies=True, just_header=False, multipart=False, decode=False):
205 """ load and returns a given page """
206
207 self.setRequestContext(url, get, post, referer, cookies, multipart)
208
209 self.header = ""
210
211 self.c.setopt(pycurl.HTTPHEADER, self.headers)
212
213 if just_header:
214 self.c.setopt(pycurl.FOLLOWLOCATION, 0)
215 self.c.setopt(pycurl.NOBODY, 1)
216 self.c.perform()
217 rep = self.header
218
219 self.c.setopt(pycurl.FOLLOWLOCATION, 1)
220 self.c.setopt(pycurl.NOBODY, 0)
221
222 else:
223 self.c.perform()
224 rep = self.getResponse()
225
226 self.c.setopt(pycurl.POSTFIELDS, "")
227 self.lastEffectiveURL = self.c.getinfo(pycurl.EFFECTIVE_URL)
228
229 self.addCookies()
230
231 try:
232 self.code = self.verifyHeader()
233
234 finally:
235 self.rep.close()
236 self.rep = None
237
238 if decode:
239 rep = self.decodeResponse(rep)
240
241 return rep
242
243 def verifyHeader(self):
244 """ raise an exceptions on bad headers """

Callers 2

getURLMethod · 0.95
HTTPRequest.pyFile · 0.45

Calls 6

setRequestContextMethod · 0.95
getResponseMethod · 0.95
addCookiesMethod · 0.95
verifyHeaderMethod · 0.95
decodeResponseMethod · 0.95
closeMethod · 0.45

Tested by

no test coverage detected