A complete pastebin.com API wrapper for Python
This is the main class to be instantiated to use pastebin.com functionality
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::
>>> pasteBin = PastebinPython(api_dev_key='123456789')
>>> print pasteBin.api_dev_key
123456789
This is where the api_user_key is stored after calling pastebin_python.pastebin.PastebinPython.createAPIUserKey()
| Returns: | str – the api_user_key |
|---|
This where the list of pastes of the current user is stored after calling pastebin_python.pastebin.PastebinPython.listUserPastes()
| Returns: | list – current user pastes list |
|---|
This will create a new paste
| Parameters: |
|
|---|---|
| Returns: | str – pastebin.com paste URL |
| Raises : | pastebin_python.pastebin_exceptions.PastebinBadRequestException |
Note
api_paste_code is the only required parameter
Almost the same as pastebin_python.pastebin.PastebinPython.createPaste() ,the only difference is that the value of api_paste_code came from the file you opened
| Parameters: |
|
|---|---|
| Returns: | str – pastebin.com paste URL |
| Raises : |
Note
filename is the only required field
This is used to request an api_user_key which can be used to create a paste as a logged in user
| Parameters: |
|
|---|---|
| Returns: | str – unique user session key |
| 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
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 |
Note
Need to call the pastebin_python.pastebin.PastebinPython.createAPIUserKey() first before calling this function Pastes list will be stored to the private variable __api_user_paste_list and can be retrieve by the property api_user_key
This will list the 18 currently trending pastes
| Returns: | list – the 18 currently trending pastes in a dictionary format |
|---|---|
| Raises : | pastebin_python.pastebin_exceptions.PastebinBadRequestException |
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 |
Note
Before calling this function, you need to call the pastebin_python.pastebin.PastebinPython.createAPIUserKey() first then call the pastebin_python.pastebin.PastebinPython.listUserPastes()
You can obtain a users personal info and certain settings by calling this function
| Returns: | list – user info in a dictionary format |
|---|---|
| Raises : | pastebin_python.pastebin_exceptions.PastebinBadRequestException |
Note
You need to call the pastebin_python.pastebin.PastebinPython.createAPIUserKey() before calling this function
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 |
This will parse the xml string returned by the the function pastebin_python.pastebin.PastebinPython.listUserPastes() or pastebin_python.pastebin.PastebinPython.listTrendingPastes()
| Parameters: | xmlString (str) – this is the returned xml string from pastebin_python.pastebin.PastebinPython.listUserPastes() or pastebin_python.pastebin.PastebinPython.listTrendingPastes() |
|---|---|
| Returns: | list – pastes info in a dictionary format |
This will parse the xml string returned by the function pastebin_python.pastebin.PastebinPython.getUserInfos()
| Parameters: | xmlString (str) – this is the returned xml string from pastebin_python.pastebin.PastebinPython.getUserInfos() |
|---|---|
| Returns: | list – user info in a dictionary format |
This will handle all of the xml string parsing
| Parameters: |
|
|---|---|
| Returns: | list – info in a dictionary format |
A private function that is responsible of calling/executing the pastebin.com functionality
| Parameters: |
|
|---|---|
| Returns: | str – the successfull output of the pastebin.com API if no exception raised |
| Raises : | pastebin_python.pastebin_exceptions.PastebinBadRequestException, pastebin_python.pastebin_exceptions.PastebinNoPastesException |
list of weak references to the object (if defined)
The pastebin.com base url
The pastebin.com API base URL
The pastebin.com API POST URL
The pastebin.com API login URL