Package: py3-wetransfer
WeTransfer V2 Upload wrapperThis module allows you to use WeTransfer services directly, from python 3.x.It is based on current WeTransfer API V2:https://developers.wetransfer.com/documentationThis project is forked from the py3wetransfer repository that was maintained by Francois Liot. You can still find ithere. It seems, however, that it is no longer maintained.InstallationInstall through Pypi:pipinstallpy3-wetransferFunctional featuresTransfer APIhttps://wetransfer.github.io/wt-api-docs/index.html#transfer-apiBoard APIhttps://wetransfer.github.io/wt-api-docs/index.html#board-apiUsageBefore starting, make sure you have an API key acquired fromDevelopers Portal.To initialize the client, you need to use your own api key.Transferupload_fileSimply send your filefromwetransferimportTransferApix=TransferApi("<my-very-personal-api-key>")print(x.upload_file("Test upload file","test.zip"))# "https://we.tl/t-ajQpdqGxco"upload_filesSend several filesfromwetransferimportTransferApix=TransferApi("<my-very-personal-api-key>")print(x.upload_files("Test upload files",["file1.zip","file2.zip"]))# "https://we.tl/t-ajQpdqGxco"BoardManage boardfromwetransferimportBoardApix=BoardApi("<my-very-personal-api-key>")board_id,board_url=x.create_new_board("test board")print(board_url)# "https://we.tl/t-ajQpdqGxco"# add linksx.add_links_to_board(board_id,[{"url":"https://wetransfer.com/","title":"WeTransfer"}])# add filesx.add_files_to_board(board_id,["test1.png","test2.jpg"])# retrieve the board object# https://wetransfer.github.io/wt-api-docs/index.html#retrieve-boards-informationboard_object=x.get_board(board_id)DebugimportloggingfromwetransferimportTransferApilogging.basicConfig()logging.getLogger().setLevel(logging.DEBUG)py3wetransfer_log=logging.getLogger('wetransfer')py3wetransfer_log.setLevel(logging.DEBUG)py3wetransfer_log.propagate=Truex=TransferApi("<my-very-personal-api-key>")print(x.upload_file("test upload","test.zip"))# "https://we.tl/t-ajQpdqGxco"If you want to see complete http traffic:importloggingfromwetransferimportTransferApiimporthttp.clientashttp_clienthttp_client.HTTPConnection.debuglevel=1logging.basicConfig()logging.getLogger().setLevel(logging.DEBUG)py3wetransfer_log=logging.getLogger('wetransfer')py3wetransfer_log.setLevel(logging.DEBUG)py3wetransfer_log.propagate=Truex=TransferApi("<my-very-personal-api-key>")print(x.upload_file("test upload","test.zip"))# "https://we.tl/t-ajQpdqGxco"Testing authenticationIf you need to test authentication validityfromwetransferimportTransferApix=TransferApi("<my-very-personal-api-key>")ifx.is_authenticated():print("we are authenticated")Additional authentication parametersWeTransfer asks officially for a valid "domain_user_id"/"user_identifier" in their API documentation, but in practise, it works perfectly without providing it.fromwetransferimportTransferApix=TransferApi("<my-very-personal-api-key>",user_identifier="81940232-9857-4cf7-b685-7a404faf5205")print(x.upload_file("test upload","test.zip"))# "https://we.tl/t-ajQpdqGxco"Unit testsThe package has a number of tests. You can run the tests by running the commandpython setup.py test. Please make sure you have defined the environment variableWE_API_KEY, otherwise all tests will fail. See 'Usage' above to see how you can obtain a key. You can set the key in a shell like so:exportWE_API_KEY=WvMlogNaWLubua6S5iuA5tRk6ZZDqwh6yaxOpGNaThis is an invalid key, so make sure to use your own key.Please note that the tests actually upload files, and this may take a while (depending on your internet connection). Also, running the tests counts toward your API key usage, so bear this in mind.