· 4 years ago · Apr 09, 2021, 10:06 AM
1"""
2Creating paste from file...
3
4"""
5from pastebin_python import PastebinPython
6from pastebin_python.pastebin_exceptions import PastebinBadRequestException, PastebinNoPastesException, PastebinFileException
7from pastebin_python.pastebin_constants import PASTE_PUBLIC, EXPIRE_10_MIN
8from pastebin_python.pastebin_formats import FORMAT_NONE, FORMAT_PYTHON, FORMAT_HTML
9
10pbin = PastebinPython(api_dev_key='<unique api key>')
11
12try:
13 pbin.createAPIUserKey('<username>','<password>')
14 print pbin.createPasteFromFile('/home/six519/Downloads/email.html', 'Email format testing 2...', FORMAT_HTML, PASTE_PUBLIC, EXPIRE_10_MIN)
15except PastebinBadRequestException as e:
16 print e.message
17except PastebinFileException as e:
18 print e.message