Created
September 12, 2016 19:50
-
-
Save madsc13ntist/e38769576246deeb4787ab201ea5d68a to your computer and use it in GitHub Desktop.
Generic disposable script for searching the ARRL for your (new) callsign
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
| #!/usr/bin/env python | |
| # Usage: ./arrl_name_search.py <your lastname, firstname> | |
| # Example: ./arrl_name_search.py "Casler, David" | |
| import sys | |
| import requests # "pip install requests" OR "sudo apt-get install python-requests" | |
| from lxml import html | |
| if __name__ == "__main__": | |
| for name_to_search in sys.argv[1:]: | |
| postdata = {'data[PubaccEn][entity_name]': name_to_search} | |
| page = requests.post("http://www.arrl.org/advanced-call-sign-search", data=postdata) | |
| tree = html.fromstring(page.content) | |
| results = tree.xpath('//div[@class="list2"]/ul/li/h3/text()') | |
| results = [x.strip() for x in results] | |
| for name_with_callsign in results: | |
| print(name_with_callsign) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment