Code Documentation - Pastebin - Python 1.0 Documentation
Code Documentation - Pastebin - Python 1.0 Documentation
0 documentation
Code Documentation
A complete pastebin.com API wrapper for Python
pastebin
class pastebin_python.pastebin. PastebinPython (**kwargs)
This is the main class to be instantiated to use pastebin.com functionality
__init__ (**kwargs)
You need to put your API Key when instantiating this class
Parameters: kwargs (dict) – keyword arguments to set settings that can be use to call
pastebin.com API function
Returns: class – pastebin_python.pastebin.PastebinPython
Example::
api_user_key
This is where the api_user_key is stored after calling
pastebin_python.pastebin.PastebinPython.createAPIUserKey()
api_user_paste_list
This where the list of pastes of the current user is stored after calling
pastebin_python.pastebin.PastebinPython.listUserPastes()
Parameters: api_paste_code (str) – this is the text that will be written inside your
paste
api_paste_name (str) – this will be the name / title of your paste
api_paste_format (str) – this will be the syntax highlighting value,
values to be assign can be found at pastebin_python.pastebin_formats
api_paste_private (int) – this makes a paste public or private, values
to be assign can be found at pastebin_python.pastebin_constants
api_paste_expire_date (str) – this sets the expiration date of your
paste, values to be assign can be found at
https://pythonhosted.org/pastebin_python/code.html 1/13
8/16/2019 Code Documentation — pastebin_python 1.0 documentation
pastebin_python.pastebin_constants
Returns: str – pastebin.com paste URL
Raises : pastebin_python.pastebin_exceptions.PastebinBadRequestException
Note: If successfull the unique user session key will be assigned to the private variable
__api_user_key and can be get with the property api_user_key
listUserPastes (api_results_limit=50)
This will list pastes created by a user
Parameters: api_results_limit (int) – this is not required but the min value should be 1
and the max value should be 1000
Returns: list – the list of of pastes in a dictionary type
Raises : pastebin_python.pastebin_exceptions.PastebinBadRequestException ,
pastebin_python.pastebin_exceptions.PastebinNoPastesException
https://pythonhosted.org/pastebin_python/code.html 2/13
8/16/2019 Code Documentation — pastebin_python 1.0 documentation
listTrendingPastes ()
This will list the 18 currently trending pastes
deletePaste (api_paste_key)
This will delete pastes created by certain users
Parameters: api_paste_key (str) – this is the paste key that which you can get in the
pastebin_python.pastebin.PastebinPython.listUserPastes() function
Returns: bool – True if the deletion is successfull else False
getUserInfos ()
You can obtain a users personal info and certain settings by calling this function
getPasteRawOutput (api_paste_key)
This will get the raw output of the paste
Parameters: api_paste_key (str) – this is the paste key that which you can get in the
pastebin_python.pastebin.PastebinPython.listUserPastes() function
Returns: str – raw output of the paste
Raises : pastebin_python.pastebin_exceptions.PastebinHTTPErrorException
_PastebinPython__parsePaste (xmlString)
This will parse the xml string returned by the the function
pastebin_python.pastebin.PastebinPython.listUserPastes() or
pastebin_python.pastebin.PastebinPython.listTrendingPastes()
https://pythonhosted.org/pastebin_python/code.html 3/13
8/16/2019 Code Documentation — pastebin_python 1.0 documentation
_PastebinPython__parseUser (xmlString)
This will parse the xml string returned by the function
pastebin_python.pastebin.PastebinPython.getUserInfos()
__weakref__
list of weak references to the object (if defined)
pastebin_exceptions
exception pastebin_python.pastebin_exceptions. PastebinBadRequestException
pastebin_constants
pastebin_python.pastebin_constants. PASTEBIN_URL = 'http://pastebin.com/'
The pastebin.com base url
https://pythonhosted.org/pastebin_python/code.html 4/13
8/16/2019 Code Documentation — pastebin_python 1.0 documentation
pastebin_python.pastebin_constants. PASTEBIN_API_POST_URL =
'http://pastebin.com/api/api_post.php'
The pastebin.com API POST URL
pastebin_python.pastebin_constants. PASTEBIN_API_LOGIN_URL =
'http://pastebin.com/api/api_login.php'
The pastebin.com API login URL
pastebin_python.pastebin_constants. PASTE_PUBLIC =0
pastebin_python.pastebin_constants. PASTE_UNLISTED =1
pastebin_python.pastebin_constants. PASTE_PRIVATE =2
pastebin_formats
pastebin_python.pastebin_formats. FORMAT_4CS = '4cs'
pastebin_options
pastebin_python.pastebin_options. OPTION_PASTE = 'paste'
https://pythonhosted.org/pastebin_python/code.html 13/13