Beispiel #1
0
def test(): 
    db = DropboxClient(session['dropbox_access_token'])
    fd = db.get('test_file.txt')
    if fd: 
        return fd.read()
    else: 
        return "nah nothing bro"
Beispiel #2
0
def sbox_download(file_name):
    db = DropboxClient(session['dropbox_access_token'])
    gd = GDriveClient(session['google_creds'])
    otp = OneTimePad()

    temp_key = db.get(file_name)
    temp_ct = gd.get(file_name)
    temp_pt = otp.decrypt(temp_key, temp_ct)

    contents = temp_pt.read()

    temp_key.close()
    temp_ct.close()
    temp_pt.close()
    return contents
Beispiel #3
0
    def _init_client(self):
        client = DropboxClient(self.bearertoken.access_token)
        updates_cursor = self.bearertoken.updates_cursor
        log.debug('Just read updates_cursor: {}'.format(updates_cursor))

        # Monkey patching the `get` method of client.
        # `AbstractCrawler` expects `client` to be a `request_oauthlib.OAuth1Session` or a
        # `request_oauthlib.OAuth1Session` with a `get` method. Here `client` is a
        # `dropbox.client`, so we monkey patch the `get` method and make it call `delta`.
        def _delta(self, cursor=updates_cursor, *args, **kwargs):
            log.debug("Querying DELTA w/ cursor: {}".format(cursor))
            return client.delta(cursor=cursor, #*args, **kwargs)
                                path_prefix='/temp/moogletest', *args, **kwargs)  # TODO remove.
        client.get = _delta
        return client