Last active
September 7, 2020 08:05
-
-
Save cxkoda/8afcc4ac7cf99590939044ae01d1b960 to your computer and use it in GitHub Desktop.
Fetch the A&A submission status using python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| from bs4 import BeautifulSoup | |
| import argparse | |
| def getData(author, article): | |
| with requests.Session() as session: | |
| # Fetch Data from server | |
| payload = { | |
| 'codeauteur': author, | |
| 'refarticle': article, | |
| } | |
| response = session.post('https://mms-aanda.obspm.fr/is/aa/detail.php', data=payload) | |
| # Find Table | |
| soup = BeautifulSoup(response.text, 'html.parser') | |
| table = soup.find_all("table")[-1] | |
| # Parse entries | |
| table = [[entry.text for entry in row.findAll('td')] for row in table.findAll('tr')] | |
| return table | |
| if __name__ == "__main__": | |
| parser = argparse.ArgumentParser(description='Fetch A&A submission status') | |
| parser.add_argument('author', help='The A&A author ID') | |
| parser.add_argument('article', help='The A&A article reference number') | |
| args = parser.parse_args() | |
| data = getData(args.author, args.article) | |
| print(f'{args.article} ({args.author})') | |
| print('\n'.join([f'{date} {status}' for (date, status) in data[1:]])) | |
| print('----------') |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
init