| 103 | |
| 104 | |
| 105 | def command_line_arguments(): |
| 106 | if len(sys.argv) == 4: |
| 107 | url = sys.argv[1] |
| 108 | width = int(sys.argv[2]) |
| 109 | height = int(sys.argv[3]) |
| 110 | if url.startswith("http://") or url.startswith("https://"): |
| 111 | global URL |
| 112 | URL = url |
| 113 | else: |
| 114 | print("[screenshot.py] Error: Invalid url argument") |
| 115 | sys.exit(1) |
| 116 | if width > 0 and height > 0: |
| 117 | global VIEWPORT_SIZE |
| 118 | VIEWPORT_SIZE = (width, height) |
| 119 | else: |
| 120 | print("[screenshot.py] Error: Invalid width and height") |
| 121 | sys.exit(1) |
| 122 | |
| 123 | elif len(sys.argv) > 1: |
| 124 | print("[screenshot.py] Error: Expected arguments: url width height") |
| 125 | sys.exit(1) |
| 126 | |
| 127 | |
| 128 | def create_browser(settings): |