Skip to content

Not able to download ANY <s>more than 10</s> pdfs using OpenAlex api #54

Description

@Pritichahal

System info: MacOs
Python: Python 3.8.20
I have used the given code pygetpapers --api openalex -q "invasive plant" -k 100 -o "invasive_plant_species_test" -c --makehtml -x --pdf --save_query

to download 100 papers from openalex api. the same code is working fine when i am putting number of paper 10.
for more than 10 papers this is giving me error

https://api.openalex.org/works?search=invasive plant&cursor=*&per-page=20
https://api.openalex.org/works?search=invasive plant&cursor=IlsxNTk5LjI1MSwgLTM3ODY5MTIwMDAwMCwgJ2h0dHBzOi8vb3BlbmFsZXgub3JnL1c0MjkxMTc0OTAwJ10i&per-page=20
https://api.openalex.org/works?search=invasive plant&cursor=IlsxMjI3LjY3MDQsIDEzODM2MDk2MDAwMDAsICdodHRwczovL29wZW5hbGV4Lm9yZy9XMjE3MjE1NTc1OSddIg==&per-page=20
https://api.openalex.org/works?search=invasive plant&cursor=IlsxMTI3LjI3MDEsIDE0MjQxMzEyMDAwMDAsICdodHRwczovL29wZW5hbGV4Lm9yZy9XMTk3NTA5ODg4NCddIg==&per-page=20
https://api.openalex.org/works?search=invasive plant&cursor=IlsxMDEzLjI2MDc0LCA5MzA3ODcyMDAwMDAsICdodHRwczovL29wZW5hbGV4Lm9yZy9XMjE0NjQzNzE2NCddIg==&per-page=20
Traceback (most recent call last):
  File "/Users/priti/miniconda3/envs/pygetpapers/bin/pygetpapers", line 8, in <module>
    sys.exit(main())
  File "/Users/priti/miniconda3/envs/pygetpapers/lib/python3.8/site-packages/pygetpapers/pygetpapers.py", line 589, in main
    callpygetpapers.create_argparser()
  File "/Users/priti/miniconda3/envs/pygetpapers/lib/python3.8/site-packages/pygetpapers/pygetpapers.py", line 583, in create_argparser
    self.runs_pygetpapers_for_given_args(self.query_namespace)
  File "/Users/priti/miniconda3/envs/pygetpapers/lib/python3.8/site-packages/pygetpapers/pygetpapers.py", line 366, in runs_pygetpapers_for_given_args
    api_handler.check_query_logic_and_run()
  File "/Users/priti/miniconda3/envs/pygetpapers/lib/python3.8/site-packages/pygetpapers/pygetpapers.py", line 225, in check_query_logic_and_run
    self.api.apipaperdownload(self.query_namespace)
  File "/Users/priti/miniconda3/envs/pygetpapers/lib/python3.8/site-packages/pygetpapers/repository/openalex.py", line 207, in apipaperdownload
    self.download_and_save_results(
  File "/Users/priti/miniconda3/envs/pygetpapers/lib/python3.8/site-packages/pygetpapers/repository/openalex.py", line 187, in download_and_save_results
    result_dict = self.openalex(
  File "/Users/priti/miniconda3/envs/pygetpapers/lib/python3.8/site-packages/pygetpapers/repository/openalex.py", line 85, in openalex
    json_return_dict = self.download_tools._make_dict_from_list(
  File "/Users/priti/miniconda3/envs/pygetpapers/lib/python3.8/site-packages/pygetpapers/download_tools.py", line 697, in _make_dict_from_list
    if key.startswith("https://doi.org/"):
AttributeError: 'NoneType' object has no attribute 'startswith'```

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions