loading

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.6545157620733661","path":"main.py","file":{"path":"main.py","content":{"asEncoding":{"base64":"aW1wb3J0IGpzb24KaW1wb3J0IHJlcXVlc3RzCgojIEFuIGFwaSBrZXkgaXMgZW1haWxlZCB0byB5b3Ugd2hlbiB5b3Ugc2lnbiB1cCB0byBhIHBsYW4KYXBpX2tleSA9ICdZT1VSX0FQSV9LRVknCgoKIyBGaXJzdCBnZXQgYSBsaXN0IG9mIGluLXNlYXNvbiBzcG9ydHMKc3BvcnRzX3Jlc3BvbnNlID0gcmVxdWVzdHMuZ2V0KCdodHRwczovL2FwaS50aGUtb2Rkcy1hcGkuY29tL3YzL3Nwb3J0cycsIHBhcmFtcz17CiAgICAnYXBpX2tleSc6IGFwaV9rZXkKfSkKCnNwb3J0c19qc29uID0ganNvbi5sb2FkcyhzcG9ydHNfcmVzcG9uc2UudGV4dCkKCmlmIG5vdCBzcG9ydHNfanNvblsnc3VjY2VzcyddOgogICAgcHJpbnQoCiAgICAgICAgJ1RoZXJlIHdhcyBhIHByb2JsZW0gd2l0aCB0aGUgc3BvcnRzIHJlcXVlc3Q6JywKICAgICAgICBzcG9ydHNfanNvblsnbXNnJ10KICAgICkKCmVsc2U6CiAgICBwcmludCgpCiAgICBwcmludCgKICAgICAgICAnU3VjY2Vzc2Z1bGx5IGdvdCB7fSBzcG9ydHMnLmZvcm1hdChsZW4oc3BvcnRzX2pzb25bJ2RhdGEnXSkpLAogICAgICAgICdIZXJlXCdzIHRoZSBmaXJzdCBzcG9ydDonCiAgICApCiAgICBwcmludChzcG9ydHNfanNvblsnZGF0YSddWzBdKQoKCgojIFRvIGdldCBvZGRzIGZvciBhIHNlcGNpZmljIHNwb3J0LCB1c2UgdGhlIHNwb3J0IGtleSBmcm9tIHRoZSBsYXN0IHJlcXVlc3QKIyAgIG9yIHNldCBzcG9ydCB0byAidXBjb21pbmciIHRvIHNlZSBsaXZlIGFuZCB1cGNvbWlu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lc3RzJywgb2Rkc19yZXNwb25zZS5oZWFkZXJzWyd4LXJlcXVlc3RzLXJlbWFpbmluZyddKQogICAgcHJpbnQoJ1VzZWQgcmVxdWVzdHMnLCBvZGRzX3Jlc3BvbnNlLmhlYWRlcnNbJ3gtcmVxdWVzdHMtdXNlZCddKQo="},"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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import json
import requests

# An api key is emailed to you when you sign up to a plan
api_key = 'YOUR_API_KEY'


# First get a list of in-season sports
sports_response = requests.get('https://api.the-odds-api.com/v3/sports', params={
    'api_key': api_key
})

sports_json = json.loads(sports_response.text)

if not sports_json['success']:
    print(
        'There was a problem with the sports request:',
        sports_json['msg']
    )

else:
    print()
    print(
        'Successfully got {} sports'.format(len(sports_json['data'])),
        'Here\'s the first sport:'
    )
    print(sports_json['data'][0])



# To get odds for a sepcific sport, use the sport key from the last request
#   or set sport to "upcoming" to see live and upcoming across all sports
sport_key = 'upcoming'

odds_response = requests.get('https://api.the-odds-api.com/v3/odds', params={
    'api_key': api_key,
    'sport': sport_key,
    'region': 'uk', # uk | us | au
    'mkt': 'h2h' # h2h | spreads | totals
})

odds_json = json.loads(odds_response.text)
if not odds_json['success']:
    print(
        'There was a problem with the odds request:',
        odds_json['msg']
    )

else:
    # odds_json['data'] contains a list of live and 
    #   upcoming events and odds for different bookmakers.
    # Events are ordered by start time (live events are first)
    print()
    print(
        'Successfully got {} events'.format(len(odds_json['data'])),
        'Here\'s the first event:'
    )
    print(odds_json['data'][0])

    # Check your usage
    print()
    print('Remaining requests', odds_response.headers['x-requests-remaining'])
    print('Used requests', odds_response.headers['x-requests-used'])