(self, recipient, file_name, body, file, file_type=None, recipient_type="device_iden")
return self._request("POST", HOST + "/pushes", data)
Push a file
            https://docs.pushbullet.com/v2/pushes
            https://docs.pushbullet.com/v2/upload-request

            Arguments:
            recipient -- a recipient
            file_name -- name of the file
            file -- a file object
            file_type -- file mimetype, if not set, python-magic will be used
            recipient_type -- a type of recipient (device, email, channel or client)
Push a file
            https://docs.pushbullet.com/v2/pushes
            https://docs.pushbullet.com/v2/upload-request
Push a file https : // docs . pushbullet . com / v2 / pushes https : // docs . pushbullet . com / v2 / upload - request
def pushFile(self, recipient, file_name, body, file, file_type=None, recipient_type="device_iden"):
        """ Push a file
            https://docs.pushbullet.com/v2/pushes
            https://docs.pushbullet.com/v2/upload-request

            Arguments:
            recipient -- a recipient
            file_name -- name of the file
            file -- a file object
            file_type -- file mimetype, if not set, python-magic will be used
            recipient_type -- a type of recipient (device, email, channel or client)
        """

        if not file_type:
            try:
                import magic
            except ImportError:
                raise Exception("No file_type given and python-magic isn't installed")

            # Unfortunately there's two libraries called magic, both of which do
            # the exact same thing but have different conventions for doing so
            if hasattr(magic, "from_buffer"):
                file_type = magic.from_buffer(file.read(1024))
            else:
                _magic = magic.open(magic.MIME_TYPE)
                _magic.compile(None)

                file_type = _magic.file(file_name)

                _magic.close()

            file.seek(0)

        data = {"file_name": file_name,
                "file_type": file_type}

        upload_request = self._request("GET",
                                       HOST + "/upload-request",
                                       None,
                                       data)

        upload = requests.post(upload_request["upload_url"],
                               data=upload_request["data"],
                               files={"file": file},
                               headers={"User-Agent": "pyPushBullet"})

        upload.raise_for_status()

        data = {"type": "file",
                "file_name": file_name,
                "file_type": file_type,
                "file_url": upload_request["file_url"],
                "body": body}
				
        data[recipient_type] = recipient

        return self._request("POST", HOST + "/pushes", data)
def pushFile ( self , recipient , file_name , body , file , file_type = None , recipient_type = "device_iden" ) : if not file_type : try : import magic except ImportError : raise Exception ( "No file_type given and python-magic isn't installed" ) # Unfortunately there's two libraries called magic, both of which do # the exact same thing but have different conventions for doing so if hasattr ( magic , "from_buffer" ) : file_type = magic . from_buffer ( file . read ( 1024 ) ) else : _magic = magic . open ( magic . MIME_TYPE ) _magic . compile ( None ) file_type = _magic . file ( file_name ) _magic . close ( ) file . seek ( 0 ) data = { "file_name" : file_name , "file_type" : file_type } upload_request = self . _request ( "GET" , HOST + "/upload-request" , None , data ) upload = requests . post ( upload_request [ "upload_url" ] , data = upload_request [ "data" ] , files = { "file" : file } , headers = { "User-Agent" : "pyPushBullet" } ) upload . raise_for_status ( ) data = { "type" : "file" , "file_name" : file_name , "file_type" : file_type , "file_url" : upload_request [ "file_url" ] , "body" : body } data [ recipient_type ] = recipient return self . _request ( "POST" , HOST + "/pushes" , data )