Skip to content

Instantly share code, notes, and snippets.

@madsc13ntist
Created September 12, 2016 19:50
Show Gist options
  • Select an option

  • Save madsc13ntist/e38769576246deeb4787ab201ea5d68a to your computer and use it in GitHub Desktop.

Select an option

Save madsc13ntist/e38769576246deeb4787ab201ea5d68a to your computer and use it in GitHub Desktop.
Generic disposable script for searching the ARRL for your (new) callsign
#!/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