diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-11-09 03:08:19 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-11-09 03:08:19 +0100 |
commit | bd8259220ab4d56ab419b7b32045b08cc9b0a7c8 (patch) | |
tree | 92f1c69d4280f8f57021083dbf878e62033eb502 /module/plugins/container/RSDF.py | |
parent | Cookie support for getURL method (diff) | |
download | pyload-bd8259220ab4d56ab419b7b32045b08cc9b0a7c8.tar.xz |
Use with statement instead open method when accessing fod + handle i/o error
Diffstat (limited to 'module/plugins/container/RSDF.py')
-rw-r--r-- | module/plugins/container/RSDF.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/module/plugins/container/RSDF.py b/module/plugins/container/RSDF.py index c3846b9e4..9c57c8ddb 100644 --- a/module/plugins/container/RSDF.py +++ b/module/plugins/container/RSDF.py @@ -5,6 +5,7 @@ import binascii import re from module.plugins.Container import Container +from module.utils import fs_encode class RSDF(Container): @@ -23,7 +24,7 @@ class RSDF(Container): from Crypto.Cipher import AES - infile = pyfile.url.replace("\n", "") + infile = fs_encode(pyfile.url.replace("\n", "")) Key = binascii.unhexlify('8C35192D964DC3182C6F84F3252239EB4A320D2500000000') IV = binascii.unhexlify('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF') @@ -32,10 +33,11 @@ class RSDF(Container): obj = AES.new(Key, AES.MODE_CFB, IV) - rsdf = open(infile, 'r') - - data = rsdf.read() - rsdf.close() + try: + with open(infile, 'r') as rsdf: + data = rsdf.read() + except IOError, e: + self.fail(str(e)) if re.search(r"<title>404 - Not Found</title>", data) is None: data = binascii.unhexlify(''.join(data.split())) |