This repository has been archived by the owner on Oct 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
web.py
46 lines (39 loc) · 1.65 KB
/
web.py
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
# ----------------------------------------- #
# web.py #
# Speed_Limit75 #
# #
# This file is a libary that makes API #
# requests to the Virtual Airline take up #
# less space in the code, and also return #
# an error should there be one. #
# ----------------------------------------- #
# Import libarys
import requests
import webbrowser
import config
# Define functions
def get(website): # GET request, returns text should there be any
try:
data = requests.get(website, headers={"Content-type":"application/json", "X-API-Key":config.APIKey})
return data.text
except Exception as e:
return str(e)
def getRaw(website): # GET request, returns reqest as an object
try:
data = requests.get(website, headers={"Content-type":"application/json", "X-API-Key":config.APIKey})
return data
except Exception as e:
return str(e)
def post(website, datax): # POST request, returns http response as an object
try:
response = requests.post(website, data = datax, headers={"Content-type":"application/json", "X-API-Key":config.APIKey})
return response
except Exception as e:
return str(e)
def isLatestVersion():
data = requests.get('https://raw.githubusercontent.com/3dash/xACARS/update-system/updates.json').json()
return (config.getPreRel == True and str(data["latestBeta"]) == config.version) or str(data["latestStable"]) == config.version
def delete(x): # For future use
return
def openWiki():
webbrowser.open_new_tab("https://github.com/3dash/xACARS/wiki")