Other Commands
Headers
Sometimes the server returns important information with the response headers. For example, it can be a special token, code or service information which should be used in subsequent requests or scraping logic. The header_get command is used to read the headers. As an operand, it takes the name of the header and reads the contents of the header to the register, so this command can only be used in a block context.
Usage example:
# READ HEADER WITH NAME `RateLimit-Remaining` and check if we exceed limit for number of connections
- find:
path: html
do:
- header_get: RateLimit-Remaining
- if:
lt: 5
type: int
do:
- sleep: 86400
In the next chapter, we'll show you how to execute fragments of scripts written in javascript.