Skip to content

Commit a68bc14

Browse files
committed
feat: adds uploader module
Upload your data: python -m xchemalign.uploader -i <tarball file> -u <fragalysis url> -p <proposal number> -t <auth token>
1 parent e90ee7d commit a68bc14

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

src/xchemalign/uploader.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828
)
2929

3030

31-
# from xchemalign import utils
32-
import utils
31+
from xchemalign import utils
3332

3433

3534
LOGIN_URL = "/accounts/login/"
@@ -138,6 +137,9 @@ def upload(input_file, url, proposal, auth_token=None):
138137
upload_url,
139138
data=validation_data,
140139
)
140+
if validation_result.url.find("keycloak") > 0:
141+
logger.error("You are not logged in to Fragalysis")
142+
return
141143

142144
result_json = validation_result.json()
143145
if not result_json["success"]:
@@ -265,9 +267,6 @@ def main():
265267

266268
upload(args.input, args.url, args.proposal, auth_token=args.token)
267269

268-
# normal upload
269-
# python src/xchemalign/uploader.py -i ../test_data/A71EV2A_xca_staging_20241104_fake_aliases.tar.gz -u http://localhost:8080/ -p lb18145-1
270-
271270

272271
if __name__ == "__main__":
273272
main()

src/xchemalign/utils.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -264,10 +264,9 @@ def log(self, *args, level=0, **kwargs):
264264
if self.logfile:
265265
print(key, *args, file=self.logfile, **kwargs)
266266

267-
# this is a hack to display messages coming from the server to
268-
# display messages that are already prefixed with error
269-
# level. not sure atm how to best integrate this with xca
270-
# logging system
267+
# this is a hack to display messages coming from the server
268+
# that are already prefixed with error level. not sure atm how
269+
# to best integrate this with xca logging system
271270
if level == -1:
272271
if self.console:
273272
print(*args, file=self.console, **kwargs)

0 commit comments

Comments
 (0)