blob: cb1b7c7e94d1c276d7d63526b03ce0844d5c31ae (
plain) (
blame)
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
31
32
33
34
35
36
37
38
39
|
from requests import session
import inputs
from bs4 import BeautifulSoup as bs
with session() as c:
try:
post('https://randopitons.re/connexion', data=payload)
region = c.get('https://randopitons.re/randonnees/region/'+region)
wsite=bs(region)
except SSLError, sslerr:
print "SSL Certificate Error. Please check the time on your computer, adjust it accordingly, or wait a bit before retrying the downloads."
for i in wsite.find_all('tr'):
randonb.append(i.get("rid"))
try:
for i in randonb:
dwnld = c.get('https://randopitons.re/randonnee/'+i+'/trace/'+maptype)
gudencoding=dwnld.text.encode('utf-8')
gpxf=open('f.gpx','a+')
gpxf.write(gudencoding)
gpxf.close()
print("FINISHED WRITING FILES")
except OSError, e:
print("Operating System error: {0}".format(e))
print(response.headers)
print(response.text)
|