File tree Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "web" : {
3
+ "client_id" : " asdfjasdljfasdkjf" ,
4
+ "client_secret" : " 1912308409123890" ,
5
+ "redirect_uris" : [" https://www.example.com/oauth2callback" ],
6
+ "auth_uri" : " https://accounts.google.com/o/oauth2/auth" ,
7
+ "token_uri" : " https://accounts.google.com/o/oauth2/token"
8
+ }
9
+ }
Original file line number Diff line number Diff line change
1
+ import json
2
+ from pprint import pprint
3
+ import requests
4
+
5
+ user_input = input ('Movie name: ' )
6
+
7
+ request = requests .get ('http://www.omdbapi.com/?apikey=3e6f7dd7&t={}' .format (user_input ))
8
+ json_result = json .loads (request .text )
9
+
10
+ print ("{}'s Awards: {}" .format (user_input , json_result ['Awards' ]))
11
+
12
+
13
+ def parse_value (value : str ):
14
+ if value .endswith ('%' ):
15
+ value = value .replace ('%' ,'' )
16
+ return '{}/10' .format (int (value ) / 10 )
17
+ elif value .endswith ('100' ):
18
+ (value , _ ) = value .split ('/' )
19
+ return '{}/10' .format (int (value ) / 10 )
20
+ return value
21
+
22
+
23
+ def display_rating (rating ):
24
+ value = rating ['Value' ]
25
+ value = parse_value (value )
26
+ print (f"{ rating ['Source' ]} - { value } " )
27
+
28
+
29
+ for rating in json_result ['Ratings' ]:
30
+ display_rating (rating )
You can’t perform that action at this time.
0 commit comments