Skip to content

Commit

Permalink
增加新内容
Browse files Browse the repository at this point in the history
增加新内容
  • Loading branch information
yqh231 committed Nov 21, 2016
1 parent 1c6ed83 commit 50630cc
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion myScrapy/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def str_to_unicode(text, encoding='utf-8'):


class Request(object):
__slots__ = ['encoding','formdata','url','method','headers','callback']
__slots__ = ['encoding','formdata','url','method','headers','callback','filename','download_type']
def __init__(self, *args, **kwargs):

try:
Expand Down Expand Up @@ -63,7 +63,18 @@ def __init__(self, *args, **kwargs):
self.callback = None
INFO("[request] nothing to callback!!")

try:
self.filename = kwargs.pop('filename')
except Exception:
self.filename = None
INFO("[request] without filename.......")

try:
self.download_type = kwargs.pop('download_type')
except Exception:
if self.method == "DOWNLOAD":
WARNING("[request] method is download,but there isn't exists and method??, stop it!!")
return



Expand Down

0 comments on commit 50630cc

Please sign in to comment.