1 #! /usr/bin/env python3
8 dir_path
= os
.path
.dirname(os
.path
.realpath(__file__
))
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
)
37 if r
.status_code
!= 200:
41 if __name__
== "__main__":