Advertisement
Guest User

Untitled

a guest
Feb 8th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. Description
  2. Develop a script which returns a list of URLs based on a given input data. Input data is a JSON file provided as an argument. This file contains Array of Hashes, and every such Hash represents an object with possible fields:
  3. - scheme: string, valid values: http|https
  4. - username: an alphanumeric string
  5. - password: an alphanumeric string
  6. - domain_name: valid domain name
  7. - port: integer
  8. - path: string
  9. - query: Hash with key-value pairs
  10. - fragment: string
  11. - disabled: boolean
  12. `domain_name` is a single required field, the rest are optional
  13. The code can be written in Ruby or Python.
  14. The output is printed to STDOUT, every URL on a separate line.
  15. All errors and exceptions have to be sent to STDERR.
  16. Example
  17. Input:
  18. [
  19. {
  20. "scheme": "http",
  21. "domain_name": "www.anydomain.com",
  22. "path": "path/to/file",
  23. "fragment": "header2"
  24. },
  25. {
  26. "scheme": "http",
  27. "domain_name": "www.domain2.com",
  28. "disabled": true
  29. },
  30. {
  31. "scheme": "https",
  32. "domain_name": "www.somedomain.com",
  33. "path": "some/path",
  34. "query": {
  35. "key1": "value1",
  36. "key2": "value2"
  37. }
  38. }
  39. ]
  40. Output:
  41. http://www.anydomain.com/path/to/file#header2
  42. https://www.somedomain.com/some/path?key1=value1&key2=value2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement