Azelphur/pyPushBullet

Can't figure what argument is missing from command

shatteringlass opened this issue · 2 comments

bin/pyPushBullet/pushbullet_cmd.py $(cat .pushbullet_api_key) file udDjRdjzWIEVDzOK /Users/federico/Downloads/spotlyrics.sh
Traceback (most recent call last):
  File "bin/pyPushBullet/pushbullet_cmd.py", line 99, in <module>
    args.func(args)
  File "bin/pyPushBullet/pushbullet_cmd.py", line 54, in pushFile
    file = p.pushFile(args.device, open(args.file, 'rb'))
TypeError: pushFile() takes at least 4 arguments (3 given)

Ah, this is something I forgot to change in the readme.

Python has built in documentation, so you could access the documentation for the function like so:

>>> print(p.pushFile.__doc__)
 Push a file
            https://docs.pushbullet.com/v2/pushes
            https://docs.pushbullet.com/v2/upload-request

            Arguments:
            device_iden -- iden of device to push to
            file_name -- name of the file
            file -- a file object
            file_type -- file mimetype, if not set, python-magic will be used

so in your example, you'd want to do something like...

p.pushFile(args.device, os.path.basename(args.file), open(args.file, 'rb'))

I'll update the readme to show the new usage.

Thank you. I figured there was something wrong with the documentation, possibly due to the recent API v2 update.