File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,9 @@ def setup(subparsers):
67
67
parser .add_argument ("--print-cookies" , "-c" ,
68
68
action = "store_true" ,
69
69
help = "print archive.org logged-in-* cookies" )
70
+ parser .add_argument ("--print-auth-header" , "-a" ,
71
+ action = "store_true" ,
72
+ help = "print an Authorization header with your IA-S3 keys" )
70
73
71
74
parser .set_defaults (func = main )
72
75
@@ -75,6 +78,21 @@ def main(args: argparse.Namespace) -> None:
75
78
"""
76
79
Main entrypoint for 'ia configure'.
77
80
"""
81
+ if args .print_auth_header :
82
+ secret = args .session .config .get ("s3" , {}).get ("secret" )
83
+ access = args .session .config .get ("s3" , {}).get ("access" )
84
+ if not secret or not access :
85
+ print ('hi' )
86
+ if not access :
87
+ print ("error: 'access' key not found in config file, try reconfiguring." ,
88
+ file = sys .stderr )
89
+ elif not secret :
90
+ print ("error: 'secret' key not found in config file, try reconfiguring." ,
91
+ file = sys .stderr )
92
+ sys .exit (1 )
93
+ print (f"Authorization: LOW { access } :{ secret } " )
94
+ sys .exit ()
95
+
78
96
if args .print_cookies :
79
97
user = args .session .config .get ("cookies" , {}).get ("logged-in-user" )
80
98
sig = args .session .config .get ("cookies" , {}).get ("logged-in-sig" )
You can’t perform that action at this time.
0 commit comments