1. API Reference¶
1.1. Compiler¶
-
class
pydoodle.
Compiler
(clientId: str, clientSecret: str)¶ Initialize the compiler which let you access the Jdoodle API.
- Parameters
clientId (str) – The clientId which you can get from https://jdoodle.com/compiler-api/
clientSecret (str) – The clientSecret which you can get from https://jdoodle.com/compiler-api/
-
execute
(script: str, language: str, link: bool = False, stdIn: Optional[str] = None, versionIndex: Optional[int] = None) → pydoodle.jdoodle.Output¶ Executes the provided script.
- Parameters
script (str) – The script to be executed. You can provide link of any code hosting site such as pastebin, hastebin, etc. (You’ve to set link parameter to True)
language (str) – Language of the script.
link (bool) – Tell if a link of any code hosting site(like pastebin, hastebin, etc..) is provided in script parameter. Defaults to False. If True it takes the script as link and fetch the script from the link.
stdIn (str, optional) – StdIn of script (If Any), defaults to None. In case of multiple inputs, they should be separated by || (double pipe).
versionIndex (int, optional) – Version Index of language, defaults to 0.
- Returns
Returns an Output object with all it’s attributes.
- Return type
- Raises
UnauthorizedRequest
: Raised if either your clientID or clientSecret is invalid.- Raises
LanguageNotSupported
: Raised if wrong language code is provided.- Raises
BadRequest
: Raised when invalid language or versionIndex is provided.- Raises
LinkNotSupported
: Raised if the provided link isn’t supported yet by pydoodle.
-
usage
() → int¶ Tells the number of credits spent today.
- Returns
The number of credit spent(number of API calls) today.
- Return type
int
Note
All types of links aren’t yet supported and not to be provided in the script
parameter.
Currently, supported links are: pastebin.com, hatstebin.com, textbin.net and pastie.org.
Working on to add more of them. Want to suggest? Start a new discussion on github repo.
Attention
Only provide links which can be visible by everyone without any kind of password.