def capture(<EOL>target_url,<EOL>user_agent="<STR_LIT>",<EOL>proxies={}<EOL>):
<EOL>domain = "<STR_LIT>"<EOL>save_url = urljoin(domain, "<STR_LIT>")<EOL>headers = {<EOL>'<STR_LIT>': user_agent,<EOL>"<STR_LIT:host>": "<STR_LIT>",<EOL>}<EOL>logger.debug("<STR_LIT>".format(domain + "<STR_LIT:/>"))<EOL>get_kwargs = dict(<EOL>timeout=<NUM_LIT>,<EOL>allow_redirects=True,<EOL>headers=headers,<EOL>)<EOL>if proxies:<EOL><INDENT>get_kwargs['<STR_LIT>'] = proxies<EOL><DEDENT>response = requests.get(domain + "<STR_LIT:/>", **get_kwargs)<EOL>response.raise_for_status()<EOL>html = str(response.content)<EOL>try:<EOL><INDENT>unique_id = html.split('<STR_LIT>', <NUM_LIT:1>)[<NUM_LIT:1>].split('<STR_LIT>', <NUM_LIT:1>)[<NUM_LIT:1>].split('<STR_LIT:">', <NUM_LIT:1>)[<NUM_LIT:0>]<EOL>logger.debug("<STR_LIT>".format(unique_id))<EOL><DEDENT>except IndexError:<EOL><INDENT>logger.warn("<STR_LIT>")<EOL>unique_id = None<EOL><DEDENT>data = {<EOL>"<STR_LIT:url>": target_url,<EOL>"<STR_LIT>": <NUM_LIT:1>,<EOL>}<EOL>if unique_id:<EOL><INDENT>data.update({"<STR_LIT>": unique_id})<EOL><DEDENT>post_kwargs = dict(<EOL>timeout=<NUM_LIT>,<EOL>allow_redirects=True,<EOL>headers=headers,<EOL>data=data<EOL>)<EOL>if proxies:<EOL><INDENT>post_kwargs['<STR_LIT>'] = proxies<EOL><DEDENT>logger.debug("<STR_LIT>".format(save_url))<EOL>response = requests.post(save_url, **post_kwargs)<EOL>response.raise_for_status()<EOL>if '<STR_LIT>' in response.headers:<EOL><INDENT>memento = str(response.headers['<STR_LIT>']).split('<STR_LIT>')[<NUM_LIT:1>]<EOL>logger.debug("<STR_LIT>".format(memento))<EOL>return memento<EOL><DEDENT>if '<STR_LIT>' in response.headers:<EOL><INDENT>memento = response.headers['<STR_LIT>']<EOL>logger.debug("<STR_LIT>".format(memento))<EOL>return memento<EOL><DEDENT>logger.debug("<STR_LIT>")<EOL>for i, r in enumerate(response.history):<EOL><INDENT>logger.debug("<STR_LIT>".format(i))<EOL>logger.debug(r.headers)<EOL>if '<STR_LIT>' in r.headers:<EOL><INDENT>memento = r.headers['<STR_LIT>']<EOL>logger.debug("<STR_LIT>".format(i+<NUM_LIT:1>, memento))<EOL>return memento<EOL><DEDENT><DEDENT>logger.error("<STR_LIT>")<EOL>logger.error("<STR_LIT>".format(response.status_code))<EOL>logger.error(response.headers)<EOL>logger.error(response.text)<EOL>raise Exception("<STR_LIT>")<EOL>
Archives the provided URL using archive.is

Returns the URL where the capture is stored.