Skip to main content

The data variable

This variable contains all data related to the current bot.

Useful properties

PropertyTypeDescription
data.UseProxyboolWhether to use the proxy assigned to the bot
data.STATUSstringThe current status of the bot
data.RAWSOURCEbyte[]The content of the last http response received
data.SOURCEstringSame as above but as a string
data.ERRORstringContains the message of the last exception caught when using safe mode (in blocks that support it)
data.ADDRESSstringThe absolute uri of the last http response (after redirection)
data.RESPONSECODEintThe status code of the last http response
data.COOKIESDictionary<string, string>The cookies sent or received so far (e.g. data.COOKIES["PHPSESSID"])
data.HEADERSDictionary<string, string>The headers of the last http response (e.g. data.HEADERS["Location"])
data.ObjectsDictionary<string, object>Holds stateful objects for cross-block use (they will get disposed automatically at the end of the script)
data.MarkedForCaptureList<string>All the names of variables marked for capture
data.CaptchaCreditdecimalThe captcha credits that are left
data.BOTNUMintThe number of the bot (0 for debugger, 1... for bots in a multi run job)

Line

PropertyTypeDescription
data.Line.DatastringThe whole (unsplit) data line assigned to the bot
data.Line.RetriesintThe amount of times the data has been retried

Proxy

PropertyTypeDescription
data.Proxy.HoststringThe host of the proxy
data.Proxy.PortintThe port of the proxy
data.Proxy.UsernamestringThe username of the proxy
data.Proxy.PasswordstringThe password of the proxy
data.Proxy.TypeProxyTypeThe type of the proxy, can be Http/Socks4/Socks5/Socks4a

... and more! Check out this page for more information on the Proxy object.

WARNING

data.Proxy is null if proxies are off, so always remember to make a null check first!

Logger

PropertyTypeDescription
data.Logger.EnabledboolEnables or disables the logger (e.g. when there is too much data to print)

Useful methods

MethodDescription
data.MarkForCapture(string varName)Adds the variable name to the data.MarkedForCapture list
data.Logger.Log(string message, string htmlColor, bool canViewAsHtml)Logs a message with the specified color, htmlColor must be e.g. #fff or white
data.Logger.LogObject(object obj, string htmlColor, bool canViewAsHtml)Logs an object with the specified color
data.Logger.Log(IEnumerable<string> enumerable, string htmlColor, bool canViewAsHtml)Logs a list of strings with the specified color
data.Logger.Clear()Clears the log

Other properties

PropertyTypeDescription
data.ConfigSettingsConfigSettingsThe config settings object
data.ProvidersProvidersProviders for captchas, browsers etc. (usually what you can configure in RL settings)
data.RandomRandomShared instance of a random number generator, use this to prevent bots from getting the same random values
data.CancellationTokenCancellationTokenWill be cancelled when a user stops the debugger or the job, useful if you want to call async methods
data.AsyncLockerAsyncLockerAsync locker for multi-thread operations
data.StepperStepperThe class that handles step-by-step debugging
data.ExecutionInfostringThe current execution info, displayed in the detailed bots view of a multi run job