Skip to content

Instantly share code, notes, and snippets.

@mclarty
Created September 1, 2018 21:41
Show Gist options
  • Save mclarty/b81cb1bee8b021005dd2b56450f1ac4a to your computer and use it in GitHub Desktop.
Save mclarty/b81cb1bee8b021005dd2b56450f1ac4a to your computer and use it in GitHub Desktop.
Download CAPWATCH database via API
import requests
url = "https://www.capnhq.gov/CAP.CapWatchAPI.Web/api/cw"
orgID = "{{orgID}}" # 362 = TXWG
unitOnly = "{{unitOnly}}" # 0 = No; 1 = Yes
user = "{{eServices username}}"
pwd = "{{eServices password}}"
payload = {'orgid': orgID, 'unitonly': unitOnly}
r = requests.get(url, params=payload, auth=(user, pwd))
open('capwatch.zip', 'wb').write(r.content)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment