Commit e7b38a38 authored by Vincent-Xavier JUMEL's avatar Vincent-Xavier JUMEL
Browse files

Transformation du script d'upload


Signed-off-by: default avatarVincent-Xavier JUMEL <vincent-xavier.jumel@lasallesaintdenis.com>
parent 1fbb3a13
Pipeline #300659 passed with stages
in 3 minutes and 37 seconds
......@@ -19,7 +19,7 @@ build:
deploy:
stage: deploy
script:
- for i in *.pdf ; do curl -u $USER:$PASS -T "$i" "https://educloud.ac-creteil.fr/remote.php/dav/files/vjumel/2deGT/" ; done
- python3 @src/publish.py $USER $PASS
- python3 @src/berthe.py $ED_USER $ED_PASS
only:
- tags # Only for tagged releases (e.g. 0.1, 1.0)
......
#!/usr/bin/env python3
import csv
import sys
import subprocess
import requests
def publish(username, password, document):
r = requests.put(
f'https://educloud.ac-creteil.fr/remote.php/dav/files/vjumel/2deGT/{document}',
auth=(username, password),
files = {'file': open(document, 'rb')}
)
return r.status_code
def read_and_publish(username, password):
with open('compile.csv','r') as fp:
fichiers = csv.DictReader(fp, delimiter=';')
for seance in fichiers:
documents = seance['fichiers'].split(' ')
status = []
for document in documents:
status.append(
publish(
username,
password,
document.replace('.tex','.pdf')
)
)
return tuple(status)
if __name__ == '__main__':
username, password= tuple(sys.argv[1:])
read_and_publish(username, password)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment