File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414}
1515
1616total = 0
17- translated = 0
18-
19- while (url ):
20- request = urllib .request .Request (url = url ,headers = headers )
17+ reviewed = 0
2118
19+ while url :
20+ request = urllib .request .Request (url = url , headers = headers )
21+
2222 with urllib .request .urlopen (request ) as response :
2323 data = json .loads (response .read ().decode ("utf-8" ))
2424 url = data ['links' ].get ('next' )
25- for resourse in data ['data' ]:
26- translated = translated + resourse ['attributes' ]['translated_strings ' ]
27- total = total + resourse ['attributes' ]['total_strings' ]
25+ for resource in data ['data' ]:
26+ reviewed += resource ['attributes' ]['reviewed_strings ' ]
27+ total += resource ['attributes' ]['total_strings' ]
2828
29- p = '{:.2%}' .format (translated / total )
29+ p = '{:.2%}' .format (reviewed / total if total > 0 else 0 )
3030print (json .dumps ({
31- 'translation' :p ,
32- 'updated_at' :datetime .utcnow ().isoformat (timespec = 'seconds' ) + 'Z' ,
33- }))
31+ 'translation' : p ,
32+ 'updated_at' : datetime .utcnow ().isoformat (timespec = 'seconds' ) + 'Z' ,
33+ }))
You can’t perform that action at this time.
0 commit comments