mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-10 08:38:28 +00:00
Merge pull request #18 from adulau/master
Fix one assignment before use and remove duplicate call to libmagic
This commit is contained in:
commit
a84ffc9ef7
2 changed files with 4 additions and 7 deletions
|
@ -109,12 +109,11 @@ def main():
|
|||
if cc is not None and cc != "EU":
|
||||
print hostl, asn, cc, pycountry.countries.get(alpha2=cc).name
|
||||
if cc == cc_critical:
|
||||
# FIXME: That's going to fail.
|
||||
publisher.warning('{0};{1};{2};{3};{4}'.format("Url", PST.p_source, PST.p_date, PST.p_name, "Detected " + str(A_values[0]) + " " + hostl + " " + cc))
|
||||
publisher.warning('{0};{1};{2};{3};{4}'.format("Url", PST.p_source, PST.p_date, PST.p_name, "Detected " + hostl + " " + cc))
|
||||
else:
|
||||
print hostl, asn, cc
|
||||
A_values = lib_refine.checking_A_record(r_serv2, domains_list)
|
||||
|
||||
A_values = lib_refine.checking_A_record(r_serv2, domains_list)
|
||||
if A_values[0] >= 1:
|
||||
PST.__setattr__(channel, A_values)
|
||||
PST.save_attribute_redis(r_serv1, channel, (A_values[0], list(A_values[1])))
|
||||
|
|
|
@ -117,6 +117,7 @@ class Paste(object):
|
|||
if self.p_nb_lines is None or self.p_max_length_line is None:
|
||||
max_length_line = 0
|
||||
f = self.get_p_content_as_file()
|
||||
line_id = 0
|
||||
for line_id, line in enumerate(f):
|
||||
length = len(line)
|
||||
if length >= max_length_line:
|
||||
|
@ -133,10 +134,7 @@ class Paste(object):
|
|||
:Example: PST._set_p_encoding()
|
||||
|
||||
"""
|
||||
try:
|
||||
return magic.Magic(mime_encoding=True).from_buffer(self.get_p_content())
|
||||
except magic.MagicException:
|
||||
pass
|
||||
return self.p_mime
|
||||
|
||||
def _set_p_hash_kind(self, hashkind):
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue