Skip to main content

A python wrapper for Gofile REST API

Project description

Gofilepy - Unofficial Python wrapper for Gofile API

PyPI Package PyPI - Downloads gofilepy - Docs PyPI - Wheel PyPI - Python Version PyPI - License

A true wrapper for Gofile's REST API.

Installation

Install Gofilepy with pip

  pip install gofilepy-api

Documentation

Usage/Examples (Free Users)

from gofilepy import GofileClient

client = GofileClient()

#Free users can this function
file = client.upload(file=open("./test.txt", "rb"))

print(file.name)
print(file.page_link) #View and download file at this link

Usage/Examples (Premium Users)

from gofilepy import GofileClient
from gofilepy.options import FileOption, FolderOption
from gofilepy.exceptions import GofileAPIAuthenticationError

client = GofileClient(token="") #Get token from gofile.io.

print(client.account.email)
print(client.account.tier)

root_folder_id = client.account.root_id
root = client.get(root_folder_id)


child = client.create_folder("NEW_FOLDER", parent_id=root.content_id)
child.set_option(FolderOption.DESCRIPTION, "New folder created with gofilepy") #More options available https://gofile.io/api
child.set_option(FolderOption.TAGS, ["example", "gofilepy"])

# Registering changes to local variable
child.content_id in root.children_ids # = false because it hasn't been updated
root.reload() #Gets any new changes/updates to the folder
child.content_id in root.children_ids # = true after root folder has been reloaded

# Copying content (files & folders)
child.copy_to(child.parent_id) #Duplicates folder in same directory
root.reload() #Now root.children_ids has another id

#uploading & downloading files
f = child.upload("./test.txt") #uploads file to newly created "child" folder

f.set_option(FileOption.HAS_DIRECT_LINK, True) #Must be set to true to download using gofilepy
print(f.direct_link) #"None"
f.reload() #now f.direct_link is updated

path = f.download("./") #downloads file to local dir
print(path) #function returns full path of downloaded file

#Deleting content
child.delete() #Deletes folder
f.delete() #Deletes file

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

gofilepy_api-0.2.6-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file gofilepy_api-0.2.6-py3-none-any.whl.

File metadata

  • Download URL: gofilepy_api-0.2.6-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for gofilepy_api-0.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 8cbb1ef7e6f0eba57ba4db23d4928db5f3c931c46bed88f7bbba494fe858a241
MD5 25734965696c50f149568c22025e7b5f
BLAKE2b-256 1e4b64b660106b0a2982295a0c0aea6b8d2e9fb29a9681937679064177a8eb8c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page