Skip to content

Commit

Permalink
Incluída recuperação de body
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiobatalha committed Apr 4, 2017
1 parent 1fbc28f commit 85a657c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
20 changes: 12 additions & 8 deletions articlemeta/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,14 +369,15 @@ def issues_history(self, collection=None, issn=None, from_date=None,

params['offset'] += LIMIT

def document(self, code, collection, fmt='xylose'):
def document(self, code, collection, fmt='xylose', body=False):

url = urljoin(self.ARTICLEMETA_URL, self.ARTICLE_ENDPOINT)

params = {
'collection': collection,
'code': code,
'format': fmt
'format': fmt,
'body': body
}

result = self._do_request(url, params, )
Expand All @@ -390,7 +391,7 @@ def document(self, code, collection, fmt='xylose'):
return result

def documents(self, collection=None, issn=None, from_date=None,
until_date=None, fmt='xylose', only_identifiers=False):
until_date=None, fmt='xylose', body=False, only_identifiers=False):

params = {
'limit': LIMIT
Expand Down Expand Up @@ -423,7 +424,8 @@ def documents(self, collection=None, issn=None, from_date=None,
document = self.document(
identifier['code'],
identifier['collection'],
fmt=fmt
fmt=fmt,
body=body
)
yield document

Expand Down Expand Up @@ -875,13 +877,14 @@ def issues_history(self, collection=None, event=None, code=None,

offset += LIMIT

def document(self, code, collection, replace_journal_metadata=True, fmt='xylose'):
def document(self, code, collection, replace_journal_metadata=True, fmt='xylose', body=False):
try:
article = self.client.get_article(
code=code,
collection=collection,
replace_journal_metadata=True,
fmt=fmt
fmt=fmt,
body=body
)
except self.ARTICLEMETA_THRIFT.ServerError as e:
msg = 'Error retrieving document: %s_%s' % (collection, code)
Expand All @@ -908,7 +911,7 @@ def document(self, code, collection, replace_journal_metadata=True, fmt='xylose'
return article

def documents(self, collection=None, issn=None, from_date=None,
until_date=None, fmt='xylose', extra_filter=None,
until_date=None, fmt='xylose', body=False, extra_filter=None,
only_identifiers=False):

fdate = from_date or DEFAULT_FROM_DATE
Expand Down Expand Up @@ -939,7 +942,8 @@ def documents(self, collection=None, issn=None, from_date=None,
identifier.code,
identifier.collection,
replace_journal_metadata=True,
fmt=fmt
fmt=fmt,
body=body
)

yield document
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

setup(
name="articlemetaapi",
version="1.7.16",
version="1.9.16",
description="Library that implements the endpoints of the ArticleMeta API",
author="SciELO",
author_email="scielo-dev@googlegroups.com",
Expand Down

0 comments on commit 85a657c

Please sign in to comment.