(request, usrdata)
return json_data
Call the cloudflare API with requested data and return results
Call the cloudflare API with requested data and return results
Call the cloudflare API with requested data and return results
def callAPI(request, usrdata):
    """ Call the cloudflare API with requested data and return results """
    # Build API Request
    data = []
    for value in usrdata:
        data.append(value)
    for value in request:
        data.append(value)

    # Encode & Send POST Data
    data = urllib.urlencode(data)
    url = "https://www.cloudflare.com/api_json.html"
    req = urllib2.Request(url, data)
    req.add_header("Content-type", "application/x-www-form-urlencoded")
    page = urllib2.urlopen(req).read()

    # Put json response into objects
    json_data = json.loads(page)
    return json_data
def callAPI ( request , usrdata ) : # Build API Request data = [ ] for value in usrdata : data . append ( value ) for value in request : data . append ( value ) # Encode & Send POST Data data = urllib . urlencode ( data ) url = "https://www.cloudflare.com/api_json.html" req = urllib2 . Request ( url , data ) req . add_header ( "Content-type" , "application/x-www-form-urlencoded" ) page = urllib2 . urlopen ( req ) . read ( ) # Put json response into objects json_data = json . loads ( page ) return json_data