File tree Expand file tree Collapse file tree 2 files changed +16
-16
lines changed Expand file tree Collapse file tree 2 files changed +16
-16
lines changed Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ def decrypt_token(encrypted_token, key):
6262# Function to get or set token
6363def get_or_set_token (production = True ):
6464 key = load_or_generate_key ()
65-
65+
6666 # Use different token files for production and test environments
6767 token_filename = "token.txt" if production else "token_test.txt"
6868 token_file = os .path .join (caltechdata_directory , token_filename )
@@ -74,8 +74,12 @@ def get_or_set_token(production=True):
7474 return token
7575 except FileNotFoundError :
7676 while True :
77- token = input (f"Enter your { 'Production' if production else 'Test' } CaltechDATA token: " ).strip ()
78- confirm_token = input (f"Confirm your { 'Production' if production else 'Test' } CaltechDATA token: " ).strip ()
77+ token = input (
78+ f"Enter your { 'Production' if production else 'Test' } CaltechDATA token: "
79+ ).strip ()
80+ confirm_token = input (
81+ f"Confirm your { 'Production' if production else 'Test' } CaltechDATA token: "
82+ ).strip ()
7983 if token == confirm_token :
8084 encrypted_token = encrypt_token (token , key )
8185 with open (token_file , "wb" ) as f :
Original file line number Diff line number Diff line change 55url = "https://data.caltechlibrary.dev/"
66
77headers = {
8- "Authorization" : "Bearer %s" % token ,
9- "Content-type" : "application/json" ,
10- }
11-
12- data = {
13- "payload" : {
14- "content" : "I want this record to be in!" ,
15- "format" : "html"
16- }
8+ "Authorization" : "Bearer %s" % token ,
9+ "Content-type" : "application/json" ,
1710}
1811
12+ data = {"payload" : {"content" : "I want this record to be in!" , "format" : "html" }}
13+
1914result = requests .post (
20- url + "/api/records/cxc6m-bef55/draft/actions/submit-review" , headers = headers , json = data
21- )
15+ url + "/api/records/cxc6m-bef55/draft/actions/submit-review" ,
16+ headers = headers ,
17+ json = data ,
18+ )
2219
2320print (result .status_code )
2421print (result .text )
25- #if result.status_code != 201:
22+ # if result.status_code != 201:
2623# print(result.text)
2724# exit()
28-
You can’t perform that action at this time.
0 commit comments