Skip to main content

Query the ADS using python

Project description

# adsquery

This tool let you query the ADS using a simple CLI.

## Installation
You'll need an API key from NASA ADS labs. Sign up for the newest version of ADS search at https://ui.adsabs.harvard.edu, visit account settings and generate a new API token. The official documentation is available at https://github.com/adsabs/adsabs-dev-api.

You can then install the tool through pip:
```
$ pip install adsquery
```

After that, you should be able to use it under the name `adsquery`:
```
$ adsquery --help
$ adsquery query --help
```

## Querying
To make a query to the ADS, try:
```
$ adsquery query [my-query]
```
The query can either be an ADS compatible query or a bashist one. For example:
```
$ adsquery query --first-author Einstein 1915
$ adsquery query ^Einstein 1915
```
will result in the same results (papers by Einstein in 1915).


## Examples
Imagine we're looking at the original 1915 Einstein's paper that's explaining for the first time the advance of the perihelion of Mercury. Here's an example of how to use adsquery
```
$ adsquery query --first-author Einstein --year 1915
[0]: 1915, Annalen der Physik — Einstein, A., Antwort auf eine Abhandlung M. v. Laues Ein Satz der Wahrscheinlichkeitsrechnung und seine Anwendung auf die Strahlungstheorie
[1]: 1915, Sitzungsberichte der Königlich Preußischen Akademie der Wissenschaften (Berlin — Einstein, Albert, Die Feldgleichungen der Gravitation
[2]: 1915, Naturwissenschaften — Einstein, A., Experimenteller Nachweis der Ampèreschen Molekularströme
[3]: 1915, Sitzungsber. preuss.Akad. Wiss — Einstein, A., Erklarung der Perihelionbewegung der Merkur aus der allgemeinen Relativitatstheorie
[4]: 1915, Sitzungsberichte der Königlich Preußischen Akademie der Wissenschaften (Berlin — Einstein, Albert, Erklärung der Perihelbewegung des Merkur aus der allgemeinen Relativitätstheorie
[5]: 1915, Sitzungsberichte der Königlich Preußischen Akademie der Wissenschaften (Berlin — Einstein, Albert, Zur allgemeinen Relativitätstheorie
[6]: 1915, Koninklijke Nederlandse Akademie van Wetenschappen Proceedings Series B Physical Sciences — Einstein, A., de Haas, W. J., Experimental proof of the existence of Ampère's molecular currents
[7]: 1915, Sitzungsberichte der Königlich Preußischen Akademie der Wissenschaften (Berlin — Einstein, Albert, Zur allgemeinen Relativitätstheorie (Nachtrag)
[8]: 1915, Deutsche Physikalische Gesellschaft — Einstein, Albert, de Haas, Wander Johannes, Notiz zu unserer Arbeit "Experimenteller Nachweis der Ampèreschen Molekularströme"
[9]: 1915, Deutsche Physikalische Gesellschaft — Einstein, Albert, Berichtigung zu meiner gemeinsam mit Herrn J. W. de Haas veröffentlichten Arbeit "Experimenteller Nachweis der Ampèreschen Molekularströme"
```
Here we see we got a few papers from the period, let's keep only the ones matching the work `Merkur` (Mercury in German)
```
Comma separated articles to download [e.g. 1-3, 4], [m] for more [q] to quit or add more parameters to request [e.g. year:2016]: Merkur
[0]: 1915, Sitzungsberichte der Königlich Preußischen Akademie der Wissenschaften (Berlin — Einstein, Albert, Erklärung der Perihelbewegung des Merkur aus der allgemeinen Relativitätstheorie

# Now let's download it
Comma separated articles to download [e.g. 1-3, 4], [m] for more [q] to quit or add more parameters to request [e.g. year:2016]: 0
Download [d], bibtex[b], quit[q]? d
```
The file is now located at `~/ADS/1915SPAW.......831E_Einstein.pdf`. If you wanted the bibtex entry, you should replace the last `d` by `b`.

# Features
- [x] query the ADS
- [x] interactively prompt the user
- [x] show bibtex reference
- [x] download pdf file

## Bugs and suggestions
Feel free to fill in an issue if you have any problem or suggestion

## Thanks
Special thanks to andycasey for providing https://github.com/andycasey/ads and the ADS!


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

adsquery-0.1.1.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

adsquery-0.1.1-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file adsquery-0.1.1.tar.gz.

File metadata

  • Download URL: adsquery-0.1.1.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for adsquery-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5e879107e7060ed78027c93891ed3ad77e7a6d1ec5802e0485d046b254dfe1ef
MD5 bb83d5870ba9f50b36a8126351d0f75b
BLAKE2b-256 bc9fb851f0bc553a5fb5ab384872f19eb6b77d36e694d489a910bd5bab0e9a83

See more details on using hashes here.

File details

Details for the file adsquery-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for adsquery-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 165275c29dd9b0d01d51d5c736e1a7350caf88876fc574cf17d6c82fd7b9c226
MD5 c3667e59c4bd56ba58e4288ab3040c4c
BLAKE2b-256 319d7dd51e26a175758964b7a2e3ba7144a6fec85e02d0a04df23b64ded59dee

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page