Remove exec bits on .doc file
[LibreOffice.git] / bin / update / upload_build_config.py
blobec5a94bf3effd8cfca46827afebed6ad25892c8e
1 #! /usr/bin/env python3
3 import sys
4 import os
5 import configparser
6 import requests
8 dir_path = os.path.dirname(os.path.realpath(__file__))
11 def main(argv):
12 updater_config = argv[2]
14 config = configparser.ConfigParser()
15 config.read(os.path.expanduser(updater_config))
17 user = config["Updater"]["User"]
18 password = config["Updater"]["Password"]
19 base_address = config["Updater"]["ServerURL"]
21 login_url = base_address + "accounts/login/"
23 session = requests.session()
24 session.get(login_url)
25 csrftoken = session.cookies['csrftoken']
27 login_data = {'username': user, 'password': password,
28 'csrfmiddlewaretoken': csrftoken}
29 session.post(login_url, data=login_data, headers={"Referer": login_url})
31 url = base_address + "update/upload/release"
32 data = {'csrfmiddlewaretoken': csrftoken}
34 build_config = os.path.join(argv[1], "build_config.json")
35 r = session.post(url, files={'release_config': open(build_config, "r")}, data=data)
36 print(r.content)
37 if r.status_code != 200:
38 sys.exit(1)
41 if __name__ == "__main__":
42 main(sys.argv)