Skip to content

Instantly share code, notes, and snippets.

@imhemish
Last active May 14, 2021 09:00
Show Gist options
  • Save imhemish/8b7f4a6018729b819f550319e841bbe0 to your computer and use it in GitHub Desktop.
Save imhemish/8b7f4a6018729b819f550319e841bbe0 to your computer and use it in GitHub Desktop.
gofile
# Upload files to gofile using their api
import requests
import json
import sys
filename = (sys.argv)[1] # You need to pass the path of file as arguement
getserver = "https://apiv2.gofile.io/getServer"
temp = requests.get(getserver)
myfiles = {'file': open(filename ,'rb')}
server = (json.loads(temp.text))["data"]["server"]
url = "https://"+server+".gofile.io/uploadFile"
data = {"email": "--your email here--"} # Add your email here
postrequest = requests.post(url, files = myfiles, data=data)
jsonloadedresponse = json.loads(postrequest.text)
print(jsonloadedresponse)
# Upload files to gofile with gui (file select dialog) using their api
import requests
import json
from tkinter import Tk
from tkinter.filedialog import askopenfilename
Tk().withdraw()
filename = askopenfilename()
getserver = "https://apiv2.gofile.io/getServer"
temp = requests.get(getserver)
myfiles = {'file': open(filename ,'rb')}
server = (json.loads(temp.text))["data"]["server"]
url = "https://"+server+".gofile.io/uploadFile"
data = {"email": "--your email here--"} # Upload files to gofile using their api
postrequest = requests.post(url, files = myfiles, data=data)
jsonloadedresponse = json.loads(postrequest.text)
print(jsonloadedresponse)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment