Skip to content

Commit

Permalink
Add auth and remove docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
J535D165 committed Oct 23, 2023
1 parent 2a4b3f8 commit f163861
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions pyalex/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ def __next__(self):


class BaseOpenAlex:

"""Base class for OpenAlex objects."""

def __init__(self, params=None):
Expand Down Expand Up @@ -286,7 +285,8 @@ def count(self):

return m["count"]

def _get_from_url(self, url, return_meta=False, params=None):
def _get_from_url(self, url, return_meta=False):
params = {"api_key": config.api_key} if config.api_key else {}
res = requests.get(
self.url,
headers={"User-Agent": "pyalex/" + __version__, "email": config.email},
Expand Down Expand Up @@ -326,23 +326,6 @@ def get(self, return_meta=False, page=None, per_page=None, cursor=None):
return self._get_from_url(self.url, return_meta=return_meta)

def paginate(self, method="cursor", page=1, per_page=None, cursor="*", n_max=10000):
"""Used for paging results of large responses using pagination.
OpenAlex offers two methods for paging: basic (offset) paging and
cursor paging. Both methods are supported by pyalex, although cursor
paging seems to be easier to implement and less error-prone.
Args:
per_page (_type_, optional): Entries per page to return. Defaults to None.
cursor (str, optional): _description_. Defaults to "*".
n_max (int, optional): Number of max results (not pages) to return.
Defaults to 10000.
Returns:
Paginator: Iterator to use for returning and processing each page
result in sequence.
"""

if method == "cursor":
value = cursor
elif method == "page":
Expand Down

0 comments on commit f163861

Please sign in to comment.