aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--algo.txt0
-rw-r--r--colorcode.pycbin0 -> 320 bytes
-rw-r--r--errmsg.pycbin0 -> 712 bytes
-rw-r--r--foldercreating.py5
-rw-r--r--foldercreating.pycbin0 -> 2430 bytes
-rw-r--r--inputs.pycbin0 -> 2628 bytes
-rw-r--r--mapsparsing.pycbin0 -> 1088 bytes
-rw-r--r--randoweb.py63
-rw-r--r--randoweb.pycbin0 -> 3274 bytes
9 files changed, 57 insertions, 11 deletions
diff --git a/algo.txt b/algo.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/algo.txt
diff --git a/colorcode.pyc b/colorcode.pyc
new file mode 100644
index 0000000..f90ec2a
--- /dev/null
+++ b/colorcode.pyc
Binary files differ
diff --git a/errmsg.pyc b/errmsg.pyc
new file mode 100644
index 0000000..90daeaa
--- /dev/null
+++ b/errmsg.pyc
Binary files differ
diff --git a/foldercreating.py b/foldercreating.py
index 5a0d91d..489d588 100644
--- a/foldercreating.py
+++ b/foldercreating.py
@@ -50,7 +50,8 @@ def mkfolder(MAIL,PSW,regionnames,foldernames,maptype,ptr,bfn):
os.mkdir(os.path.join(def_folder,foldernames[ptr]))
else:
os.mkdir(os.path.join(a_folder,foldernames[ptr]))
- rdo.randoweb(MAIL,PSW,regionnames[ptr],maptype,bfn)
+ #rdo.testalakon()
+ rdo.randoweb(MAIL,PSW,regionnames[ptr],maptype,bfn,def_folder+a_str)
except OSError, er:
print e.os
print format(er)
@@ -69,7 +70,7 @@ def mkallfolder(MAIL,PSW,regionnames,foldernames,maptype,bfn):
try:
print "on attaque par le "+regionnames[iii]
- rdo.randoweb(MAIL,PSW,regionnames[iii],maptype,bfn)
+ rdo.randoweb(MAIL,PSW,regionnames[iii],maptype,bfn,def_folder+a_str)
except:
raise
iii=iii+1
diff --git a/foldercreating.pyc b/foldercreating.pyc
new file mode 100644
index 0000000..3cdd505
--- /dev/null
+++ b/foldercreating.pyc
Binary files differ
diff --git a/inputs.pyc b/inputs.pyc
new file mode 100644
index 0000000..761c5a2
--- /dev/null
+++ b/inputs.pyc
Binary files differ
diff --git a/mapsparsing.pyc b/mapsparsing.pyc
new file mode 100644
index 0000000..48557c1
--- /dev/null
+++ b/mapsparsing.pyc
Binary files differ
diff --git a/randoweb.py b/randoweb.py
index 3957ef1..57fd7f3 100644
--- a/randoweb.py
+++ b/randoweb.py
@@ -4,21 +4,63 @@ import inputs
from bs4 import BeautifulSoup as bs
import colorcode as clc
import errmsg as e
+import os
import mapsparsing as mpp
randonb=[]
a_str="eh"
baseurl='https://randopitons.re/randonnee/'
-def filei(dwnld,bfn):
+def filei(dwnld,fpath):
try:
- f=open(bfn,'a+')
+ f=open(fpath,'a+')
gudencoding=dwnld.text.encode('utf-8')
f.write(gudencoding)
f.close()
except:
raise
-def randoweb(MAIL,PSW,region,maptype,bfn):
+
+
+def testalakon():
+ payload = {
+ 'mail': 'lionel.miquel46@gmail.com',
+ 'password': 'VEobWylvUdToab8'
+ }
+ with session() as c:
+ try:
+ c.post('https://randopitons.re/connexion', data=payload)
+ regionpage = c.get('https://randopitons.re/randonnees/region/cirque-cilaos')
+ try:
+ wsite=bs(regionpage.text, "lxml")
+ print "Voici les donnees:"+regionpage.text
+ except:
+ raise
+ try:
+ for i in wsite.find_all('tr'):
+ randonb.append(i.get("rid"))
+ try:
+ randonb.pop(0)
+ print "POPPED"
+ except:
+ raise
+ print "Voici les numéros de randos:"
+ print randonb
+ try:
+ for i in randonb:
+ print clc.okgreen+"Maybe downloading "+baseurl+i+'/trace/gpx'
+ try:
+ dwnld = c.get(baseurl+i+'/trace/gpx')
+ except:
+ raise
+ filei(dwnld,'/home/lili/Randopitons/Cirque de Cilaos/f-'+i+'.gpx')
+ except:
+ raise
+ except:
+ raise
+ except:
+ raise
+
+def randoweb(MAIL,PSW,region,maptype,bfn,folderpath):
payload = {
'mail': MAIL,
'password': PSW
@@ -53,32 +95,35 @@ def randoweb(MAIL,PSW,region,maptype,bfn):
for i in randonb:
if maptype==1:
try:
+ print clc.okgreen+"Maybe downloading "+baseurl+i+'/trace/gpx'
dwnld = c.get(baseurl+i+'/trace/gpx')
except TypeError:
pass
except:
raise
- filei(dwnld,bfn)
+ filei(dwnld,folderpath+bfn)
elif maptype==2:
try:
- dwnld = c.get(baseurl+i+'/trace/kml')
+ print clc.okgreen+"Maybe downloading "+baseurl+i+'/trace/trk'
+ dwnld = c.get(baseurl+i+'/trace/trk')
except TypeError:
pass
except:
raise
- filei(dwnld,bfn)
+ filei(dwnld,folderpath+bfn)
else:
try:
- dwnld = c.get(baseurl+i+'/trace/trk')
+ print clc.okgreen+"Maybe downloading "+baseurl+i+'/trace/kml'
+ dwnld = c.get(baseurl+i+'/trace/kml')
except TypeError:
pass
except:
raise
- filei(dwnld,bfn)
+ filei(dwnld,folderpath+bfn)
except:
raise
try:
- mpp.mapparsing(maptype,bfn)
+ mpp.mapparsing(maptype,folderpath+bfn)
except:
raise
print("Finished writing file.")
diff --git a/randoweb.pyc b/randoweb.pyc
new file mode 100644
index 0000000..3665ac5
--- /dev/null
+++ b/randoweb.pyc
Binary files differ