Base client object
Create a new share. Takes a keyword argument.
Example:
new_share = client.create_share( title="Example Title" )
Get a specific file. Does not require authentication.
Example:
file = client.get_file("4ddfds", 0)
Get a specific share. Does not require authentication.
Example:
share = client.get_share("4ddfds")
Gets all shares.
Example:
shares = client.get_shares()
Gets all shares.
Example:
shares_list = client.get_shares_list()
Upload a file to the Gett service. Takes keyword arguments.
Example:
file = client.upload_file(filaname="foo", data=open("foo.txt").read())
Base error class
Encapsulate a file in the Gett service.
Attributes
This method downloads the contents of the file represented by a GettFile object’s metadata.
NOTE: You are responsible for handling any encoding/decoding which may be necessary.
Example:
file = client.get_file("4ddfds", 0)
print file.contents()
This method removes the file’s content and metadata from the Gett service. There is no way to recover the data once this method has successfully completed.
Example:
client.get_file("4ddfds", 0).destroy()
Retrieve current file metadata from the Gett service.
Example:
file = client.get_file("4ddfds", 0)
print "File size: %s" % file.size # File size: 96
file.send_data(put_url=file.upload_url, data=open("example.txt", "rb").read())
file.refresh()
print "File size: %s" % file.size # File size: 109
This method transmits data to the Gett service.
Example:
if file.send_data(put_url=file.upload_url, data=open("example.txt", "rb").read()):
print "Your file has been uploaded."
This method returns a thumbnail representation of the file if the data is a supported graphics format.
Example:
file = client.get_file("4ddfds", 0)
open("thumbnail.jpg", "wb").write(file.thumbnail())
This method generates URLs which allow overwriting a file’s content with new content. The output is suitable for use in the send_data() method below.
Example:
file = client.get_file("4ddfds", 0)
file.send_data(put_url=file.upload_url, data=open("example.txt", "rb").read())
Base request class
get
Make a GET call to a remote endpoint
post
Make a POST call to a remote endpoint
NOTE: Passed POST data will be automatically serialized to a JSON string if it’s not already a string
put
Make a PUT call to a remove endpoint
Encapsulate a request to the Gett service
Encapsulate responses from the Gett service
Encapsulates Gett user functionality
access_token
Returns a valid access token. If the user is not currently logged in, attempts to do so. If the current time exceeds the grace period, attempts to retrieve a new access token.
Example:
print "Your access token is currently %s" % client.user.access_token()
login
Use the current credentials to get a valid Gett access token.
Example:
if client.user.login():
print "You have %s bytes of storage remaining." % ( client.user.storage_limit - client_user.storage_used )
refresh
Refresh this user object with data from the Gett service
Example:
if client.user.refresh():
print "User data refreshed!"
print "You have %s bytes of storage remaining." % ( client.user.storage_limit - client_user.storage_used )