Commit 8e1a5a6f authored by Giuseppe Tropea's avatar Giuseppe Tropea
Browse files

enabled DEL. created fromrobot endpoint

parent 11b02d0b
Loading
Loading
Loading
Loading
+19 −2
Original line number Diff line number Diff line
import requests
import json

site_request = requests.get("https://docs.google.com/a/google.com/spreadsheets/d/1AfsmGlSyb7rqMgfRSF-S4PpcUyTi7Fhx/gviz/tq?range=A1:N394&headers=1&tq=select%20G%2CI&tqx=out:json")
googlesheet_url = "https://docs.google.com/a/google.com/spreadsheets/d/1AfsmGlSyb7rqMgfRSF-S4PpcUyTi7Fhx/gviz/tq?range=A1:N394&headers=1&tq=select%20G%2CI&tqx=out:json"
site_request = requests.get(googlesheet_url)

site_response = str(site_request.content)

@@ -26,3 +27,19 @@ for row in table["rows"]:
        column_index += 1
    testcaseinfo.append(testcase)
print(testcaseinfo)

# The URL of the REST endpoint of the NoSQL database
dburl = "http://ec2-18-153-159-20.eu-central-1.compute.amazonaws.com:5555/googlesheet"
requests.delete(dburl)
# Set the appropriate headers for JSON, if required by the endpoint
headers = {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    # Include any other headers the API requires
}
# Make the POST request
response = requests.post(dburl, data=json.dumps(testcaseinfo), headers=headers)

# Check the response (status code, content, etc.)
print(response.status_code)
print(response.text)
+14 −2
Original line number Diff line number Diff line
@@ -6,12 +6,24 @@ googlesheetschema = {
        'required': True
    }
}

googlesheet = {
    # most global settings can be overridden at resource level
    'resource_methods': ['GET', 'POST', 'DELETE'],
    'allow_unknown': True,
    'schema': googlesheetschema
}

fromrobotschema = {
    'tp_id': {
        'type': 'string',
        'required': True
    }
}
fromrobot = {
    # most global settings can be overridden at resource level
    'resource_methods': ['GET', 'POST'],
    'allow_unknown': True,
    'schema': googlesheetschema
}

DOMAIN = {'googlesheet': googlesheet}
 No newline at end of file
DOMAIN = {'googlesheet': googlesheet, 'fromrobot': fromrobotschema}
 No newline at end of file