-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcampingdates
More file actions
31 lines (28 loc) · 922 Bytes
/
campingdates
File metadata and controls
31 lines (28 loc) · 922 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import urllib2
parks = {}
# parks['TEST'] = 72486
parks['North Pines'] = 70927
parks['Lower Pines'] = 70928
parks['Upper Pines'] = 70925
parks['Tuolumne'] = 70926
parks['Bridalveil'] = 70931
parks['Wawona'] = 70924
parks['Crane Flat'] = 70930
parks['Hodgon'] = 70929
for x, y in parks.iteritems():
count = 0
linelist = []
print 'Campground:', x
url = 'http://www.recreation.gov/campsiteCalendar.do?page=calendar&contractCode=NRSO&parkId=%s&calarvdate=06/19/2016&sitepage=true&startIdx=0' % y
req = urllib2.Request(url, headers={'User-Agent': "Magic Browser"})
for line in urllib2.urlopen(req):
if "status a" in line:
linelist.append(line)
count += 1
if count > 0:
for n in range(1, 8):
count = 0
for x in linelist:
if "avail%d" % n in x:
count += 1
print 18+n, count