-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_api.py
More file actions
588 lines (557 loc) · 26.8 KB
/
check_api.py
File metadata and controls
588 lines (557 loc) · 26.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
#import mysecrets
import os
import requests
#from urllib.parse import urlparse
import json
def inqUrl(url):
response = requests.get(url)
response.encoding = response.apparent_encoding
jsonData = None
if(response.text):
jsonData = json.loads(response.text)
return jsonData
def addSubscribeMessageToResults(results=[], name='', url='', full=False):
gitOrg = os.getenv('GITHUB_OWNER')
results.append("Subscribe to "+name+" API:")
results.append("1. Login and 'Subscribe to Test' at "+url)
results.append("2. Make sure to enter 'Start Free Plan' and press 'Subscribe' - **don't** enter credit card data!")
results.append(" ")
if(full):
results.append("If it doesn't help, **recheck** the registration and the key entry:")
results.append("1. Please register at https://rapidapi.com/auth/sign-up")
results.append("2. Copy your API key from (**X-RapidAPI-Key**) from the [same site]("+url+")")
results.append("3. Assign the API key as (new?) organization secret or edit it at https://github.com/organizations/"+gitOrg+"/settings/secrets/actions")
results.append(" * Name: **RAPIDAPI_KEY** ")
results.append(" * Value: **Your key here** ")
return True
def inqRapidDeeplTranslator4(results=[]):
gitOrg = os.getenv('GITHUB_OWNER')
apiKey = os.getenv('RAPIDAPI_KEY')
results.append("### RapidAPI: Deepl-Translator-4")
url = "https://deepl-translator4.p.rapidapi.com/api/v1/translate"
payload = {"text":"Klimawandel","from":"de","to":"en"}
headers = {
'x-rapidapi-key': apiKey,
'x-rapidapi-host': "deepl-translator4.p.rapidapi.com",
'Content-Type': 'application/json'
}
response = requests.post(url, headers=headers, json=payload)
#response = requests.request('POST', url, headers=headers, json=payload)
response.encoding = response.apparent_encoding
#print(response.text)
print(['Deepl-Translator-4', response.status_code]) #200
#504 : The request to the API has timed out
if((response.text) and (not response.status_code in [204, 500, 504])):
results.append(":white_check_mark: Deepl-Translator-4 respone fine")
text = response.text
if(not isinstance(text,str)):
text = text.decode("utf-8")
jsonData = json.loads(text)
if('message' in jsonData):
if('You are not subscribed to this API.'==jsonData['message']):
results.append(":no_entry: **Not** subscribed to Deepl-Translator-4")
addSubscribeMessageToResults(results, "Deepl-Translator-4", "https://rapidapi.com/sibaridev/api/rapid-translate-multi-traduction")
return False
if ('text' in jsonData):
results.append(":white_check_mark: Deepl-Translator-4 status fine")
if (jsonData['text']):
results.append(":white_check_mark: Deepl-Translator-4 results found")
return True
else:
results.append(":no_entry: Deepl-Translator-4 results **not** found")
results.append("Maybe retry later...?") #?
return False
else:
results.append(":no_entry: Deepl-Translator-4 status **failed**:")
addSubscribeMessageToResults(results, "Deepl-Translator-4", "https://rapidapi.com/sibaridev/api/rapid-translate-multi-traduction")
return False
else:
results.append(":no_entry: Deepl-Translator-4 respone **failed**")
results.append("Maybe retry later...?") #?
return False
return False
def inqRapidMultiTraductionTranslate(results=[]):
gitOrg = os.getenv('GITHUB_OWNER')
apiKey = os.getenv('RAPIDAPI_KEY')
results.append("### RapidAPI: Multi-Traduction-Translate")
url = "https://rapid-translate-multi-traduction.p.rapidapi.com/t"
payload = {"q":"Klimawandel","from":"de","to":"en"}
headers = {
'x-rapidapi-key': apiKey,
'x-rapidapi-host': "rapid-translate-multi-traduction.p.rapidapi.com",
'Content-Type': 'application/json'
}
response = requests.post(url, headers=headers, json=payload)
#response = requests.request('POST', url, headers=headers, json=payload)
response.encoding = response.apparent_encoding
#print(response.text)
print(['Multi-Traduction-Translate', response.status_code]) #200
#504 : The request to the API has timed out
if((response.text) and (not response.status_code in [204, 500, 504])):
results.append(":white_check_mark: Multi-Traduction-Translate respone fine")
text = response.text
if(not isinstance(text,str)):
text = text.decode("utf-8")
jsonData = json.loads(text)
if('message' in jsonData):
if('You are not subscribed to this API.'==jsonData['message']):
results.append(":no_entry: **Not** subscribed to Multi-Traduction-Translate")
addSubscribeMessageToResults(results, "Multi-Traduction-Translate", "https://rapidapi.com/sibaridev/api/rapid-translate-multi-traduction")
return False
if (len(jsonData)>0):
results.append(":white_check_mark: Multi-Traduction-Translate status fine")
if (jsonData[0]):
results.append(":white_check_mark: Multi-Traduction-Translate results found")
return True
else:
results.append(":no_entry: Multi-Traduction-Translate results **not** found")
results.append("Maybe retry later...?") #?
return False
else:
results.append(":no_entry: Multi-Traduction-Translate status **failed**:")
addSubscribeMessageToResults(results, "Multi-Traduction-Translate", "https://rapidapi.com/sibaridev/api/rapid-translate-multi-traduction")
return False
else:
results.append(":no_entry: Multi-Traduction-Translate respone **failed**")
results.append("Maybe retry later...?") #?
return False
return False
def inqRapidFreeGoogleTranslator(results=[]):
gitOrg = os.getenv('GITHUB_OWNER')
apiKey = os.getenv('RAPIDAPI_KEY')
results.append("### RapidAPI: Free-Google-Translator")
url = "https://free-google-translator.p.rapidapi.com/external-api/free-google-translator"
querystring = {"query":"Klimawandel","from":"de","to":"en"}
payload = {"translate":"rapidapi"}
headers = {
'x-rapidapi-key': apiKey,
'x-rapidapi-host': "free-google-translator.p.rapidapi.com",
'Content-Type': 'application/json'
}
response = requests.post(url, headers=headers, json=payload, params=querystring)
#response = requests.request('POST', url, headers=headers, json=querystring)
response.encoding = response.apparent_encoding
print(response.text)
print(['Free-Google-Translator', response.status_code]) #200
#504 : The request to the API has timed out
if((response.text) and (not response.status_code in [204, 500, 504])):
results.append(":white_check_mark: Free-Google-Translator respone fine")
text = response.text
if(not isinstance(text,str)):
text = text.decode("utf-8")
jsonData = json.loads(text)
if('message' in jsonData):
if('You are not subscribed to this API.'==jsonData['message']):
results.append(":no_entry: **Not** subscribed to Free-Google-Translator")
addSubscribeMessageToResults(results, "Free-Google-Translator", "https://rapidapi.com/joshimuddin8212/api/free-google-translator")
return False
if ('translateTo' in jsonData):
results.append(":white_check_mark: Free-Google-Translator status fine")
if ('translation' in jsonData):
results.append(":white_check_mark: Free-Google-Translator results found")
return True
else:
results.append(":no_entry: Free-Google-Translator results **not** found")
results.append("Maybe retry later...?") #?
return False
else:
results.append(":no_entry: Free-Google-Translator status **failed**:")
addSubscribeMessageToResults(results, "Free-Google-Translator", "https://rapidapi.com/joshimuddin8212/api/free-google-translator")
return False
else:
results.append(":no_entry: Free-Google-Translator respone **failed**")
results.append("Maybe retry later...?") #?
return False
return False
def inqRapidTextTranslator2(results=[]):
gitOrg = os.getenv('GITHUB_OWNER')
apiKey = os.getenv('RAPIDAPI_KEY')
results.append("### RapidAPI: Text-Translator-2")
url = "https://text-translator2.p.rapidapi.com/translate"
payload = {"text":"Klimawandel","source_language":"de","target_language":"en"}
headers = {
'x-rapidapi-key': apiKey,
'x-rapidapi-host': "text-translator2.p.rapidapi.com",
'Content-Type': 'application/x-www-form-urlencoded'
}
response = requests.post(url, headers=headers, data=payload)
#response = requests.request('POST', url, headers=headers, json=payload)
response.encoding = response.apparent_encoding
#print(response.text)
print(['Text-Translator-2', response.status_code]) #200
#504 : The request to the API has timed out
if((response.text) and (not response.status_code in [204, 500, 504])):
results.append(":white_check_mark: Text-Translator-2 respone fine")
text = response.text
if(not isinstance(text,str)):
text = text.decode("utf-8")
jsonData = json.loads(text)
if('message' in jsonData):
if('You are not subscribed to this API.'==jsonData['message']):
results.append(":no_entry: **Not** subscribed to Text-Translator-2")
addSubscribeMessageToResults(results, "Text-Translator-2", "https://rapidapi.com/dickyagustin/api/text-translator2")
return False
if ('data' in jsonData):
results.append(":white_check_mark: Text-Translator-2 status fine")
if ('translatedText' in jsonData['data']):
results.append(":white_check_mark: Text-Translator-2 results found")
return True
else:
results.append(":no_entry: Text-Translator-2 results **not** found")
results.append("Maybe retry later...?") #?
return False
else:
results.append(":no_entry: Text-Translator-2 status **failed**:")
addSubscribeMessageToResults(results, "Text-Translator-2", "https://rapidapi.com/dickyagustin/api/text-translator2")
return False
else:
results.append(":no_entry: Text-Translator-2 respone **failed**")
results.append("Maybe retry later...?") #?
return False
return False
def inqRapidMicroTranslate3(results=[]):
gitOrg = os.getenv('GITHUB_OWNER')
apiKey = os.getenv('RAPIDAPI_KEY')
results.append("### RapidAPI: Microsoft-Translator-3")
url = "https://microsoft-translator-text-api3.p.rapidapi.com/translate"
querystring = {"textType":"plain","from":"de","to":"en"}
payload = [{"text":"Klimawandel"}]
headers = {
'x-rapidapi-key': apiKey,
'x-rapidapi-host': "microsoft-translator-text-api3.p.rapidapi.com",
'Content-Type': 'application/json'
}
response = requests.post(url, headers=headers, json=payload, params=querystring)
#response = requests.request('POST', url, headers=headers, json=querystring)
response.encoding = response.apparent_encoding
print(response.text)
print(['Microsoft-Translator-3', response.status_code]) #200
#504 : The request to the API has timed out
if((response.text) and (not response.status_code in [204, 500, 502, 504])):
results.append(":white_check_mark: Microsoft-Translator-3 respone fine")
text = response.text
if(not isinstance(text,str)):
text = text.decode("utf-8")
jsonData = json.loads(text)
if('message' in jsonData):
if('You are not subscribed to this API.'==jsonData['message']):
results.append(":no_entry: **Not** subscribed to Microsoft-Translator-3")
addSubscribeMessageToResults(results, "Microsoft-Translator-3", "https://rapidapi.com/apiship-apiship-default/api/microsoft-translator-text-api3")
return False
if('messages' in jsonData):
if('The API is unreachable, please contact the API provider'==jsonData['message']):
results.append(":no_entry: Microsoft-Translator-3 **not** reachable")
results.append("Maybe retry later...?") #?
return False
if (len(jsonData)>0):
results.append(":white_check_mark: Microsoft-Translator-3 status fine")
if ('translations' in jsonData[0]):
results.append(":white_check_mark: Microsoft-Translator-3 results found")
return True
else:
results.append(":no_entry: Microsoft-Translator-3 results **not** found")
results.append("Maybe retry later...?") #?
return False
else:
results.append(":no_entry: Microsoft-Translator-3 status **failed**:")
addSubscribeMessageToResults(results, "Deep-Translate-1", "https://rapidapi.com/apiship-apiship-default/api/microsoft-translator-text-api3")
return False
else:
results.append(":no_entry: Microsoft-Translator-3 respone **failed**")
results.append("Maybe retry later...?") #?
return False
return False
def inqRapidDeepTranslate1(results=[]):
gitOrg = os.getenv('GITHUB_OWNER')
apiKey = os.getenv('RAPIDAPI_KEY')
results.append("### RapidAPI: Deep-Translate-1")
url = "https://rapidapi.com/gatzuma/api/deep-translate1"
payload = {"q":"Klimawandel","source":"de","target":"en"}
headers = {
'x-rapidapi-key': apiKey,
'x-rapidapi-host': "deep-translate1.p.rapidapi.com",
'Content-Type': 'application/json'
}
response = requests.post(url, headers=headers, json=payload)
#response = requests.request('POST', url, headers=headers, json=payload)
response.encoding = response.apparent_encoding
#print(response.text)
print(['Deep-Translate-1', response.status_code]) #200
#504 : The request to the API has timed out
if((response.text) and (not response.status_code in [204, 500, 504])):
results.append(":white_check_mark: Deep-Translate-1 respone fine")
text = response.text
if(not isinstance(text,str)):
text = text.decode("utf-8")
jsonData = json.loads(text)
if('message' in jsonData):
if('You are not subscribed to this API.'==jsonData['message']):
results.append(":no_entry: **Not** subscribed to Deep-Translate-1")
addSubscribeMessageToResults(results, "Deep-Translate-1", "https://rapidapi.com/gatzuma/api/deep-translate1")
return False
if ('data' in jsonData):
results.append(":white_check_mark: Deep-Translate-1 status fine")
if ('translations' in jsonData['data']):
results.append(":white_check_mark: Deep-Translate-1 results found")
return True
else:
results.append(":no_entry: Deep-Translate-1 results **not** found")
results.append("Maybe retry later...?") #?
return False
else:
results.append(":no_entry: Deep-Translate-1 status **failed**:")
addSubscribeMessageToResults(results, "Deep-Translate-1", "https://rapidapi.com/gatzuma/api/deep-translate1")
return False
else:
results.append(":no_entry: Deep-Translate-1 respone **failed**")
results.append("Maybe retry later...?") #?
return False
return False
def checkRapidAPI(results=[]):
gitOrg = os.getenv('GITHUB_OWNER')
apiKey = os.getenv('RAPIDAPI_KEY')
results.append("### RapidAPI")
apiKeyExists = True
if(apiKey):
if(apiKey == '1a2b3c4d5e6f7g8h9i0j1k2l3m4n5o6p7q8r9s0t1u2v3w4x5y'):
apiKeyExists = False
else:
apiKeyExists = False
if(not apiKeyExists):
results.append(":no_entry: RapidAPI key **missing**:")
results.append("1. Please register at https://rapidapi.com/auth/sign-up")
results.append("2. Login and 'Subscribe to Test' at https://rapidapi.com/bonaipowered/api/google-news22")
results.append("3. Make sure to enter 'Start Free Plan' and press 'Subscribe' - **don't** enter credit card data!")
results.append("2. Copy your API key from (**X-RapidAPI-Key**) from the same site")
results.append("3. Assign the API key as new organization secret at https://github.com/organizations/"+gitOrg+"/settings/secrets/actions/new")
results.append(" * Name: **RAPIDAPI_KEY** ")
results.append(" * Value: **Your key here** ")
return False
else:
results.append(":white_check_mark: RapidAPI key exists")
return True
return False
def inqNewsApi(results=[]):
apiKey = os.getenv('NEWSAPI_KEY')
url = ('https://newsapi.org/v2/everything?q=Klimawandel&language=de&apiKey='+apiKey)
response = requests.get(url)
response.encoding = response.apparent_encoding
if(response.text):
results.append(":white_check_mark: NewsAPI respone fine")
jsonData = json.loads(response.text)
if ('ok'==jsonData['status']):
results.append(":white_check_mark: NewsAPI status fine")
if(jsonData['totalResults']>0):
results.append(":white_check_mark: NewsAPI results found")
return True
else:
results.append(":no_entry: NewsAPI results **not** found")
return False
else:
results.append(":no_entry: NewsAPI status **failed**:")
results.append("Please recheck the API key and its assignment:")
results.append("1. Please register at https://newsapi.org/register")
results.append("2. Login and get your API key at https://newsapi.org/account")
results.append("3. Assign the API key as new organization secret at https://github.com/organizations/"+gitOrg+"/settings/secrets/actions/new")
results.append(" * Name: **NEWSAPI_KEY** ")
results.append(" * Value: **Your key here** ")
return False
else:
results.append(":no_entry: NewsAPI respone failed")
results.append("Please recheck the API key and its assignment:")
results.append("1. Please register at https://newsapi.org/register")
results.append("2. Login and get your API key at https://newsapi.org/account")
results.append("3. Assign the API key as new organization secret at https://github.com/organizations/"+gitOrg+"/settings/secrets/actions/new")
results.append(" * Name: **NEWSAPI_KEY** ")
results.append(" * Value: **Your key here** ")
return False
return False
def checkNewsApi(results=[]):
gitOrg = os.getenv('GITHUB_OWNER')
apiKey = os.getenv('NEWSAPI_KEY')
results.append("### NewsAPI")
apiKeyExists = True
if(apiKey):
if(apiKey == '1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7'):
apiKeyExists = False
else:
apiKeyExists = False
if(not apiKeyExists):
results.append(":no_entry: NewsAPI key **missing**:")
results.append("1. Please register at https://newsapi.org/register")
results.append("2. Login and get your API key at https://newsapi.org/account")
results.append("3. Assign the API key as new organization secret at https://github.com/organizations/"+gitOrg+"/settings/secrets/actions/new")
results.append(" * Name: **NEWSAPI_KEY** ")
results.append(" * Value: **Your key here** ")
return False
else:
results.append(":white_check_mark: NewsAPI key exists")
inqNewsApi(results)
return True
return False
def addRegisterGeonamesToResults(results=[]):
gitOrg = os.getenv('GITHUB_OWNER')
newGitOrg = gitOrg.replace("-","_")
results.append("1. Please register with username (i.e.: "+newGitOrg+") at https://www.geonames.org/login")
results.append("2. Assign the choosen username as new organization secret at https://github.com/organizations/"+gitOrg+"/settings/secrets/actions/new")
results.append(" * Name: **GEONAMES_KEY** ")
results.append(" * Value: **Your username here** ")
return False
def recheckRegisterGeonamesToResults(results=[]):
gitOrg = os.getenv('GITHUB_OWNER')
newGitOrg = gitOrg.replace("-","_")
results.append("1. Please recheck the username (i.e.: "+newGitOrg+") at https://www.geonames.org/login")
results.append("2. Modify the organization secret at https://github.com/organizations/"+gitOrg+"/settings/secrets/actions/GEONAMES_KEY")
results.append(" * Choose 'enter a new value.'")
results.append(" * Make sure to enter your username ('Welcome **username**.') - but without the trailing dot!")
results.append(" * Save")
return False
def inqGeonamesApi(results=[]):
apiKey = os.getenv('GEONAMES_KEY')
url = ('http://api.geonames.org/searchJSON?name=Freiburg&country=DE&maxRows=10&username='+apiKey)
response = requests.get(url)
response.encoding = response.apparent_encoding
if(response.text):
results.append(":white_check_mark: Geonames respone fine")
jsonData = json.loads(response.text)
#print(jsonData)
if('message' in jsonData):
if(('credits for demo has been exceeded' in jsonData['message']) or ('user does not exist' in jsonData['message'])):
results.append(":no_entry: **Not** registered at Geonames")
addRegisterGeonamesToResults(results)
return False
if('invalid user' in status['message']):
results.append(":no_entry: **Not** registered at Geonames (or invalid)")
recheckRegisterGeonamesToResults(results)
return False
if(('user account not enabled to use the free webservice' in status['message']) or ('Please enable it on your account page' in status['message'])):
results.append(":no_entry: **Not** enabled at Geonames - enable at https://www.geonames.org/manageaccount ")
#addRegisterGeonamesToResults(results)
return False
if('status' in jsonData):
status = jsonData['status']
if('message' in status):
print(status['message'])
if(('credits for demo has been exceeded' in status['message']) or ('user does not exist' in status['message'])):
results.append(":no_entry: **Not** registered at Geonames")
addRegisterGeonamesToResults(results)
return False
if('invalid user' in status['message']):
results.append(":no_entry: **Not** registered at Geonames (or invalid)")
recheckRegisterGeonamesToResults(results)
return False
if(('user account not enabled to use the free webservice' in status['message']) or ('Please enable it on your account page' in status['message'])):
results.append(":no_entry: **Not** enabled at Geonames - enable at https://www.geonames.org/manageaccount ")
#addRegisterGeonamesToResults(results)
return False
if ('totalResultsCount' in jsonData):
results.append(":white_check_mark: Geonames result fine")
if(jsonData['totalResultsCount']>0):
results.append(":white_check_mark: Geonames results found")
return True
else:
results.append(":no_entry: Geonames results **not** found")
return False
else:
results.append(":no_entry: Geonames status **failed**:")
results.append("Please recheck the API key and its assignment:")
addRegisterGeonamesToResults(results)
return False
else:
results.append(":no_entry: Geonames respone failed")
results.append("Please recheck the API key and its assignment:")
addRegisterGeonamesToResults(results)
return False
return False
def checkGeonamesApi(results=[]):
gitOrg = os.getenv('GITHUB_OWNER')
apiKey = os.getenv('GEONAMES_KEY')
results.append("### GeonamesAPI")
apiKeyExists = True
if(apiKey):
if(apiKey == 'demo_demo_123'):
apiKeyExists = False
print('123')
else:
apiKeyExists = False
print('no key')
if(not apiKeyExists):
results.append(":no_entry: Geonames key **missing**:")
addRegisterGeonamesToResults(results)
return False
else:
results.append(":white_check_mark: Geonames key exists")
inqGeonamesApi(results)
return True
return False
def checkGithubOrganization(results=[]):
gitOrg = os.getenv('GITHUB_OWNER')
gitRepo = os.getenv('GITHUB_REPO')
#print(['Org',gitOrg,'Repo',gitRepo])
results.append("### Github Organization")
if(gitOrg):
orgData = inqUrl('https://api.github.com/users/'+gitOrg)
#print(orgData) # check for 'type': 'Organization', 'user_view_type': 'public'
if(not 'Organization'==orgData['type']):
results.append(":no_entry: Github Organization **missing**:")
results.append("1. Create new organization at https://github.com/account/organizations/new?plan=free")
results.append("2. Organization name could be i.e.: "+gitOrg+"Org")
results.append("3. Organization belongs to 'My personal account'")
results.append("4. No add-ons")
results.append("5. Accept Terms")
results.append("6. Fork again - in your new organization!")
## REFORK
return (True, False)
else:
results.append(":white_check_mark: Github Organization exists")
orgAssigned = False
myOrgs = inqUrl('https://api.github.com/users/KMicha/orgs?per_page=100')
#print(myOrgs)
for org in myOrgs:
if(org['id']==orgData['id']):
orgAssigned = True
if(orgAssigned):
results.append(":white_check_mark: Github Organization assigned")
return (True, True)
else:
results.append(":no_entry: Github Organization **not** assigned (or not public):")
results.append("1. Goto https://github.com/orgs/"+gitOrg+"/people")
results.append("2. Check if KMicha is listed as Members")
results.append("3. Else: 'Invite member' KMicha")
return (True, True)
else:
results.append("No check possible: maybe running locally?")
return (False, False)
return (True, True)
results=[]
results.append("# BASICS")
(runOnGithub, runInOrganization) = checkGithubOrganization(results)
results.append("\n---\n")
if(runInOrganization):
checkNewsApi(results)
results.append("\n---\n")
checkGeonamesApi(results)
results.append("\n---\n")
rapidAPIExists = checkRapidAPI(results)
results.append("\n---\n")
if(rapidAPIExists):
## TRANSLATE:
results.append("# TRANSLATE")
results.append("\n---\n")
#inqRapidDeepTranslate1(results) # Defect?
#results.append("\n---\n") #
inqRapidMicroTranslate3(results)
results.append("\n---\n")
inqRapidTextTranslator2(results)
results.append("\n---\n")
inqRapidFreeGoogleTranslator(results)
results.append("\n---\n")
inqRapidMultiTraductionTranslate(results)
results.append("\n---\n")
inqRapidDeeplTranslator4(results)
#print(results)
if(runOnGithub):
f = open("CHECK.md", "w")
for res in results:
f.write(res+" \n")
f.close()