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.- Raises
LimitExceeded
: Raised when the daily limit has exceeded, means no more API calls for today. Learn more: https://jdoodle.com/compiler-api
- 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.
1.2. Output¶
- class pydoodle.jdoodle.Output(response_json: dict)¶
The output of the executed script. :param response_json: The response from the API :type response_json: dict
- property cpuTime: str¶
- Returns
The time taken in the execution of the script (in seconds).
- Return type
str
- property memory: str¶
- Returns
Memory used to execute the script (in kilobytes).
- Return type
str
- property output: str¶
- Returns
The output of the executed script.
- Return type
str
- property statusCode¶
- Returns
The status code of the API request.
- Return type
int