Created
March 27, 2015 20:06
-
-
Save krmaxwell/b7e8a49f8ebd74cbea86 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try: | |
# Note that this request does NOT go through proxies | |
logging.debug("Domain submission: {url}|{data}".format(url=url, data=domain_data)) | |
domain_response = requests.post(url, headers=headers, data=domain_data) | |
# pylint says "Instance of LookupDict has no 'ok' member" | |
if domain_response.status_code == requests.codes.ok: | |
domain_response_data = domain_response.json() | |
if domain_response_data['return_code'] == 0: | |
inserted_domain = True | |
else: | |
logging.info("Submitted domain info for {md5} to CRITs, response was {data}".format(md5=md5, | |
data=domain_response_data)) | |
else: | |
logging.info("Submission of {url} failed: {code}".format(url=url, code=domain_response.status_code)) | |
except: | |
logging.info("Exception caught from CRITs when submitting domain: {response}".format(code=domain_response)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment