aboutsummaryrefslogtreecommitdiff
path: root/randoweb.py
diff options
context:
space:
mode:
authorLionel <lionel.miquel46@gmail.com>2018-10-16 23:09:26 +0200
committerLionel <lionel.miquel46@gmail.com>2018-10-16 23:09:26 +0200
commit480a2935e0eba6fe2577b10f317f2fdbea55d7ce (patch)
tree5058e857a3027cb0912c03a9aa99b1881ee11d5b /randoweb.py
parent32aa9e84ee635b37f4cff37112e3e62837c914f4 (diff)
downloadrandopitons-480a2935e0eba6fe2577b10f317f2fdbea55d7ce.tar.gz
randopitons-480a2935e0eba6fe2577b10f317f2fdbea55d7ce.zip
presque fini wlh
Diffstat (limited to 'randoweb.py')
-rw-r--r--randoweb.py38
1 files changed, 27 insertions, 11 deletions
diff --git a/randoweb.py b/randoweb.py
index 332bdad..5955f14 100644
--- a/randoweb.py
+++ b/randoweb.py
@@ -3,10 +3,20 @@ import inputs
from bs4 import BeautifulSoup as bs
import colorcode as clc
import errmsg as e
+import mapsparsing as mpp
-def randoweb():
+
+
+
+def randoweb(MAIL,PSW,region,maptype,bfn):
+ payload = {
+ 'mail': MAIL,
+ 'password': PSW
+ }
+
with session() as c:
+
try:
post('https://randopitons.re/connexion', data=payload)
region = c.get('https://randopitons.re/randonnees/region/'+region)
@@ -15,23 +25,29 @@ def randoweb():
randonb.append(i.get("rid"))
except SSLError, sslerr:
print e.sslerr
-
-
-
-
+
try:
for i in randonb:
- dwnld = c.get('https://randopitons.re/randonnee/'+i+'/trace/'+maptype)
+ dwnld="all the interwebz"
+ if maptype==1:
+ dwnld = c.get('https://randopitons.re/randonnee/'+i+'/trace/gpx')
+ gpxf=open(bfn,'a+')
+ elif maptype==2:
+ dwnld = c.get('https://randopitons.re/randonnee/'+i+'/trace/kml')
+ gpxf=open(bfn,'a+')
+ else:
+ dwnld = c.get('https://randopitons.re/randonnee/'+i+'/trace/trk')
+ gpxf=open(bfn,'a+')
+
gudencoding=dwnld.text.encode('utf-8')
-
- gpxf=open('f.gpx','a+')
gpxf.write(gudencoding)
gpxf.close()
-
+
+ mpp.mapparsing(maptype,bfn)
print("Finished writing files.")
- except OSError, e:
+ except OSError, er:
print e.os
- print format(e)
+ print format(er)