Package: pyastroapi
pyAstroApiLow level library interfacing with NASA's ADSABS api.InstallationPyPipip install pyAstroApiFrom sourceInstall dependencies:pipinstall-rrequirements.txtBuild and install softwarepipinstall.Testing locallyInstall dependencies:pipinstall-rrequirements_dev.txtand then to run with one python versionpytestor use tox to test multiple versions of pythontoxGetting startedFull documentation can be found atreadthedocs.Here is a quick start guide for the very basics.ADS KeyFirst you will need your own ADS api key:https://ui.adsabs.harvard.edu/user/settings/tokenThis can be saved to the file:~/.ads/dev_keyBasic searchingTo quickly just search and get a set of papers back from ADS:importpyastroapi.articlesa=articles.journal(search="^farmer year:2020")Thesearchfield can be any standard ADS query. The objectais now ajournalwhich is a dict-like object ofarticle's.You can also constrcut ajournalfrom a list of bibcodes:a=articles.journal(bibcodes=["2020ApJ...902L..36F","2021ApJ...923..214F"])Ajournalcan be accessed either by specifying the bibcode:paper=a["2020ApJ...902L..36F"]or iterated over like a list (or accessed with an index, e.g.,a[0])forpaperina:print(paper.title)The objectpaperis anarticlewhich encapsulates all the methods needed to access the information ADS has on a paper. The initial search (Either via access through ajournalor by creating an article with:articles.article("2020ApJ...902L..36F")) will fetch a set of standard fields from ADS.
Non-standard fields will require additional fetch's to ADS servers, but this is wrapped so all you need to do is try to access the field and the data will be fetched for you.Most fields can be accessed as properties:paper.titlepaper.authorpaper.abstractThough some fields are function calls:paper.citations()paper.references()Extra informationAnarticlealso contains wrappers into some of the other ADS features:paper.url.journal()Get the publisher HTML urlpaper.pdf.arxiv()Download the Arxiv pdf to a file given by the papers bibcode (e.g., 2020ApJ...902L..36F.pdf)paper.export.bibtex()Get the papers BibTexpaper.metrics.histograms()Return a histogram of the metric data for the paperpaper.visual.author()Return the author network visualization for the paper.APIFunctions and classes inside the pyastroapi namespace are provided to provide convenient wrappers around the output of ADSABS API.
Though at this time not ever endpoint has a wrapper.However, the pyastroapi.api namespace provides a low-level API that handles setting all the arguments necessary for each of the API end points.List of theADSABS API'sare currently implemented inside the pyastroapi.api namespaceSearch (Including big queries)Stored SearchLibraries (apart from editing an existing library)ExportMetricsAuthor AffiliationCitation HelperClassic import (Caveat: I don't have a classic account to test with)ObjectsRecommender (Except matchdoc)ReferenceNotificationsVisualizationsContributingContributions are welcome either as pull requests or as bug reports. If reporting a bug please include the exact code you used and
if applicable the bibcodes for any paper you where trying to access.AcknowledgementsThis project is not affiliated with NASA or ADSABS.This research has made use of NASA’s Astrophysics Data System Bibliographic Services.