loading

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.893045699325697","path":"main.py","file":{"path":"main.py","content":{"asEncoding":{"base64":"IyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjCiMgVGhpcyBjb2RlIGRpc3BsYXlzIHJhbmRvbSB2ZXJzZSBmcm9tIHRoZSBRdXJhbiBib3RoIGluICAgIwojIEFyYWJpYyBvcmlnaW5hbCBhbmQgRW5nbGlzaCB0cmFuc2xhdGlvbiAoUGlja3RoYWxsKSAgICAgICMKIyAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSAjCiMgQVBJIGZyb20gaHR0cDovL2FwaS5hbHF1cmFuLmNsb3VkICAgICAgICAgICAgICAgICAgICAgICAgIwojIEF1dGhvcjogQWJkdWwgQmFxaSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICMKIyBEYXRlOiBPY3QgMjAxOCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAjCiMgIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIwoKaW1wb3J0IHJhbmRvbQppbXBvcnQgcmVxdWVzdHMKCiMgVGhpcyBmdW5jdGlvbiB0YWtlcyBhIHJhbmRvbSBudW1iZXIKIyBiZXR3ZWVuIDEgYW5kIDYyMzcgKHdoaWNoIGFyZSB0aGUgdG90YWwgbnVtYmVyIG9mIHZlcnNlcyBpbiB0aGUgUXVyYW4KIyBhbmQgcmV0dXJuczoKIyB2ZXJzZV9hIDogdmVyc2UgaW4gYXJhYmljCiMgdmVyc2VfZW46IHZlcnNlIGluIEVuZ2xpc2ggKFBpY2t0aGFsbCB0cmFuc2xhdGlvbikKIyBzdXJhOiBOYW1lIG9m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5rWzBdKQogICAgcHJpbnQoJ1xuJykKICAgIHByaW50KGxpbmtbMV0pCiAgICBwcmludCgnXG4nKQogICAgcHJpbnQobGlua1syXSkKICAgIHByaW50KCctLS0tLS0tLS0tLS0tLS0tJykKICAgIAo="},"asBuffer":null},"loaded":true}}
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
############################################################
# This code displays random verse from the Quran both in   #
# Arabic original and English translation (Pickthall)      #
# -------------------------------------------------------- #
# API from http://api.alquran.cloud                        #
# Author: Abdul Baqi                                       #
# Date: Oct 2018                                           #
# ##########################################################

import random
import requests

# This function takes a random number
# between 1 and 6237 (which are the total number of verses in the Quran
# and returns:
# verse_a : verse in arabic
# verse_en: verse in English (Pickthall translation)
# sura: Name of surah in english, then number of sura and after : the number of verse
# example: Taa-Haa(20):108

def bring_verse(verse):
    url = 'http://api.alquran.cloud/ayah/'+str(verse)+'/editions/quran-uthmani,en.pickthall'
    json_data = requests.get(url).json()
    verse_a = json_data['data'][0]['text']
    verse_en = json_data['data'][1]['text']
    sura = json_data['data'][0]['surah']['englishName']+\
           '('+str(json_data['data'][0]['surah']['number'])+'):'+\
           str(json_data['data'][0]['numberInSurah'])
    return [verse_a,verse_en,sura]

while True:
    verse = input(">>press enter for a random verse (press 'q' to quit): ")
    if verse == 'q':
        print('Thank you, come again')
        break
    
    aya = random.randint(1,6237)
    link = bring_verse(aya)
    print('----------------')
    print(link[0])
    print('\n')
    print(link[1])
    print('\n')
    print(link[2])
    print('----------------')