Package: pyfilemail
Welcome to pyfilemail’s documentation!Pyfilemail is a command line tool and API for sending and recieving files withFilemailbased onrequestsand filemail’sAPI.To avoid nagging about API KEY you should register and get onehere.
If you register for a paid plan you unlock all features and will be able to add/delete/update your transfers/contacts/group/company settings.
Without registering you’ll still be able to send files as a free plan user but remember to use the--freeargument in the command line tool.For more info on the different plans please go toFilemailI’ve tried to keep this api as simple as possible and rely on filemail’s own validation of data to keep you all in check :)
The reason for this is that I don’t work at filemail and have no insight in what validation they have for the data passed.
It also saves me a lot of head ache writing rock solid validation code and I think this is a more flexible way of doing it if the Filemail team decides to change
the API in any way.Appart frompyfilemail.Userandpyfilemail.Transferclasses, all return objects from filemail aredictobjects based on json responses.So far this has been developed and tested on Ubuntu 16.04.
I’ll try to get my hands on a Windows and OSX machine and addapt the code to make sure it works there as well.API documentation is available atreadthedocsAny feedback is more than welcome and please report bugs throughgithubInstallationpipinstallpyfilemailDisclaimerI use this software myself and have not yet experienced broken files, but I take no responsibility for the files sent or received using pyfilemail whether it comes to content or state of files passing through.
Pyfilemail is still work in progress and parts of the API might change as I develop and test it further.Command line examplepyfilemail\--frommyemail@somedomain.com\--tolucky.b@receiver.com\--free\--subject"Amazing document!"\--message"Have you seen how amazingly big this document is?"\--payload/path/to/file.ext/path/to/folder/Add API KEYYou can add the API KEY to the local config file with the--add-api-keyargumet.pyfilemail--add-api-keyYOUR-API-KEY-FROM-FILEMAILnetrcYou may use a .netrc file to store login information. Make sure you restrict access to only allow your own user to read it.#$HOME/.netrc example:machineyourfilemailuser@email.comloginyourfilemailuser@email.compasswordtopsecretpasswordCommand line helpusage:pyfilemail[-h][--version][--add-api-keyADD_API_KEY][--free][-nc][--compress][--confirm][--quiet][--days3][--downloads0][--messageMESSAGE][--notify][--subjectSUBJECT][--torecipient@receiver.com[recipient@receiver.com...]][--passwordPASSWORD][--fromUSERNAME][--store-password][--delete-password][--payloadPAYLOAD[PAYLOAD...]]CommandlineFilemailtransferthroughPythonoptionalarguments:-h,--helpshowthishelpmessageandexit--versionshowprogram'sversionnumberandexit--add-api-keyADD_API_KEYAddAPIKEYfromFilemailtolocalconfigfile--freeSendfileswithoutaregisteredFilemailaccount-nc,--no-checksumSkipcalculatingchecksumonaddedfiles--compressCompress(ZIP)databeforesending?--confirmEmailconfirmationaftersendingthefiles?--quietLogonlywarningstoconsole--days3Numberofdaysthefile(s)areavailablefordownload--downloads0Numberoftimesthefile(s)maybedownloaded.0=unlimited--messageMESSAGEMessagetotherecipient(s)ofthetransfer--notifyNotifywhenrecipientsdownloadyourfiles?--subjectSUBJECTSubjectofemailsentwithtransfer--torecipient@receiver.com[recipient@receiver.com...]Recipient(s)ofthetransfer(emailaddresses)--passwordPASSWORDProtecttransferwiththesuppliedpassword--fromUSERNAMEYouremailaddress--store-passwordStoreuserpasswordinkeychainifavailable--delete-passwordDeletepasswordstoredinkeychain--payloadPAYLOAD[PAYLOAD...]File(s)and/orfolder(s)totransferPython API examplesimportpyfilemail# Setup a transfer# Initialize Filemail with as free (as in free beer) useruser=pyfilemail.User(username='user@mailprovider.com')transfer=pyfilemail.Transfer(user,to='lucky@recipient.com',subject='My BIG file no email can handle',message='You will not belive the speed of this download!',notify=True,confirmation=True,days=7,password='JuSt2BeSaf£')# Add a single file to transfer queuetransfer.add_files('/path/to/my/BIG_file.ext')# Add multiple fileslist_of_files=['/path/to/my/BIG_file_1.ext','/path/to/my/BIG_file_2.ext','/path/to/my/BIG_file_3.ext']transfer.add_files(list_of_files)# Send files to recipient(s)transfer.send(auto_complete=True)# Login to a registered Filemail accountuser=pyfilemail.User(username='user@mailprovider.com',password='YourSecretPassword2014')# List all prior transferstransfers=user.get_sent(expired=True)# Get contactsuser.get_contacts()# Get one single contactcontact=user.get_contact('contact@email.address.com')# Update that contactcontact['name']='Mr. Orange'user.update_contact(contact)# Delete contactunfriendly=user.get_contact('contact@email.address.com')user.delete_contact(unfriendly)# Download received transfers for the past 7 daystransfers=user.get_received(age=7)fortransferintransfers:transfer.download(destination='/home/myname/Downloads')# Logoutuser.logout()