<commit_before>#!/usr/bin/python
from os import environ
import requests
import click
import databag_local as databag
import base64

admin_key = environ.get("NEWRELIC_API_KEY")

def create_synthetics_monitor(monitor_name, monitor_url, monitor_type="BROWSER", monitor_frequency=15):
  """
  Source: https://docs.newrelic.com/docs/apis/synthetics-rest-api/monitor-examples/manage-synthetics-monitors-via-rest-api
  Command:
  curl -v \
     -X POST -H 'X-Api-Key:{Admin API key}' \
     -H 'Content-Type: application/json' https://synthetics.newrelic.com/synthetics/api/v1/monitors \
     -d '{  "name" : "Monitor Name",  "frequency" : 15, "uri" : "Monitor URL", "locations" : [ "AWS_US_WEST_2" ], "type" : "SIMPLE"}'
  """
  synthetics_endpoint = r'https://synthetics.newrelic.com/synthetics/api/v1/monitors'
  headers = {
    'X-Api-Key': admin_key,
    'Content-Type': 'application/json'
  }
  payload = build_monitor(monitor_name, monitor_type, monitor_url=monitor_url, frequency=monitor_frequency)
  r = requests.post(synthetics_endpoint, json=payload, headers=headers)
  if r.status_code != 201:
    print "Status Code is {code}".format(code=r.status_code)
    print r.text
    return False

  print "\tSuccessfully added {monitor} -> {monitor_url}".format(monitor=monitor_name, monitor_url=monitor_url)
  #return True<commit_msg>Need to use the server databag.<commit_after>#!/usr/bin/python
from os import environ
import requests
import click
import databag as databag
import base64

admin_key = environ.get("NEWRELIC_API_KEY")

def create_synthetics_monitor(monitor_name, monitor_url, monitor_type="BROWSER", monitor_frequency=15):
  """
  Source: https://docs.newrelic.com/docs/apis/synthetics-rest-api/monitor-examples/manage-synthetics-monitors-via-rest-api
  Command:
  curl -v \
     -X POST -H 'X-Api-Key:{Admin API key}' \
     -H 'Content-Type: application/json' https://synthetics.newrelic.com/synthetics/api/v1/monitors \
     -d '{  "name" : "Monitor Name",  "frequency" : 15, "uri" : "Monitor URL", "locations" : [ "AWS_US_WEST_2" ], "type" : "SIMPLE"}'
  """
  synthetics_endpoint = r'https://synthetics.newrelic.com/synthetics/api/v1/monitors'
  headers = {
    'X-Api-Key': admin_key,
    'Content-Type': 'application/json'
  }
  payload = build_monitor(monitor_name, monitor_type, monitor_url=monitor_url, frequency=monitor_frequency)
  r = requests.post(synthetics_endpoint, json=payload, headers=headers)
  if r.status_code != 201:
    print "Status Code is {code}".format(code=r.status_code)
    print r.text
    return False

  print "\tSuccessfully added {monitor} -> {monitor_url}".format(monitor=monitor_name, monitor_url=monitor_url)
  #return True
{'fraction_non_alphanumeric': 0.13928304705003733, 'fraction_numerical': 0.008961911874533234, 'mean_word_length': 4.64, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4245896', 'n_tokens_mistral': 978, 'n_tokens_neox': 917, 'n_words': 176}