|
@@ -89,7 +89,9 @@ class anafSPV(object):
|
|
def download_message(self, cui, id_, details):
|
|
def download_message(self, cui, id_, details):
|
|
response = self.session.get(self.BASEURL.format(self.DLURL.format(id_)), cookies=self.requests_cookies)
|
|
response = self.session.get(self.BASEURL.format(self.DLURL.format(id_)), cookies=self.requests_cookies)
|
|
os.makedirs(os.path.join(self.DLLOC, cui), exist_ok=True)
|
|
os.makedirs(os.path.join(self.DLLOC, cui), exist_ok=True)
|
|
- with open(os.path.join(self.DLLOC, cui, details + '.pdf'), 'wb') as file:
|
|
|
|
|
|
+ words = details.split()
|
|
|
|
+ result_string = ' '.join(words[:3]) if len(words) >= 3 else ' '.join(words[:2]) if len(words) == 2 else details
|
|
|
|
+ with open(os.path.join(self.DLLOC, cui, result_string + '.pdf'), 'wb') as file:
|
|
file.write(response.content)
|
|
file.write(response.content)
|
|
|
|
|
|
def get_vector(self, cui):
|
|
def get_vector(self, cui):
|