<gh_stars>0
import requests
from requests.auth import HTTPBasicAuth

"""
Register User -
-------------

curl -X POST http://localhost:5000/user -H "Content-Type: application/json" -d '{"username":"<EMAIL>","password":"<PASSWORD>"}'


{
    "Location": "http://localhost:5000/user/1", 
    "username": "<EMAIL>"
}
"""
payload = '{"username":"<EMAIL>","password":"<PASSWORD>"}'
header={'Content-Type': 'application/json'}
r = requests.post("http://localhost:5000/user", data=payload, headers=header)

print(r.text)

"""
Login Registered User -
---------------------

curl -X GET http://localhost:5000/user -H "Content-Type: application/json" -d '{"duration":3600}' -u <EMAIL>:kma123


{
    "token": {
        "duration": 3600, 
        "value": "<KEY>"
    }, 
    "user": {
        "name": "", 
        "rating": 5, 
        "tags": [], 
        "username": "<EMAIL>"
    }
}
"""

payload = '{"duration":3600}'
header={'Content-Type': 'application/json'}
r = requests.get("http://localhost:5000/user", data=payload, headers=header, auth=HTTPBasicAuth('<EMAIL>', 'kma123'))

print(r.text)

"""
Update Registered User Profile-
------------------------------

curl -X PUT http://localhost:5000/user -H "Content-Type: application/json" -d '{"name":"<NAME>","rating":5,"tags":["dbpedia","npg"]}' -u <EMAIL>:kma123


{
    "name": "<NAME>", 
    "rating": 5, 
    "tags": [
        "dbpedia", 
        "npg"
    ], 
    "username": "<EMAIL>"
}
"""
payload = '{"name":"<NAME>","rating":5,"tags":["dbpedia","npg"]}'
header={'Content-Type': 'application/json'}
r = requests.put("http://localhost:5000/user", data=payload, headers=header, auth=HTTPBasicAuth('<EMAIL>', 'kma123'))

print(r.text)

"""
Single/Bulk Question Request-
----------------------------

curl -X GET http://localhost:5000/question -H "Content-Type: application/json" -d '{"stats":"True"}' -u <EMAIL>:kma123
curl -X GET http://localhost:5000/question -H "Content-Type: application/json" -d '{"bulk":10,"stats":"True"}' -u <EMAIL>:kma123

[]

"""
payload = '{"bulk":10,"stats":"True"}'
header={'Content-Type': 'application/json'}
r = requests.get("http://localhost:5000/question", data=payload, headers=header, auth=HTTPBasicAuth('<EMAIL>', 'kma123'))

print(r.text)

"""
Submit Answer Request-
---------------------

curl -X PUT http://localhost:5000/answer -H "Content-Type: application/json" -d '{"value":"1","comment":"Just another comment","qid":"570eec1df6bf2d1e58a88479"}' -u <EMAIL>:kma123

{
    "message": [
        "Question not found for qid: ", 
        "570eec1df6bf2d1e58a88479"
    ]
}

"""

payload = '{"value":"1","comment":"Just another comment","qid":"570eec1df6bf2d1e58a88479"}'
header={'Content-Type': 'application/json'}
r = requests.put("http://localhost:5000/answer", data=payload, headers=header, auth=HTTPBasicAuth('<EMAIL>', 'kma123'))

print(r.text)







import requests
from requests.auth import HTTPBasicAuth

"""
Register User -
-------------

curl -X POST http://localhost:5000/user -H "Content-Type: application/json" -d '{"username":"<EMAIL>","password":"<PASSWORD>"}'


{
    "Location": "http://localhost:5000/user/1", 
    "username": "<EMAIL>"
}
"""
payload = '{"username":"<EMAIL>","password":"<PASSWORD>"}'
header={'Content-Type': 'application/json'}
r = requests.post("http://localhost:5000/user", data=payload, headers=header)

print(r.text)

"""
Login Registered User -
---------------------

curl -X GET http://localhost:5000/user -H "Content-Type: application/json" -d '{"duration":3600}' -u <EMAIL>:kma123


{
    "token": {
        "duration": 3600, 
        "value": "<KEY>"
    }, 
    "user": {
        "name": "", 
        "rating": 5, 
        "tags": [], 
        "username": "<EMAIL>"
    }
}
"""

payload = '{"duration":3600}'
header={'Content-Type': 'application/json'}
r = requests.get("http://localhost:5000/user", data=payload, headers=header, auth=HTTPBasicAuth('<EMAIL>', 'kma123'))

print(r.text)

"""
Update Registered User Profile-
------------------------------

curl -X PUT http://localhost:5000/user -H "Content-Type: application/json" -d '{"name":"<NAME>","rating":5,"tags":["dbpedia","npg"]}' -u <EMAIL>:kma123


{
    "name": "<NAME>", 
    "rating": 5, 
    "tags": [
        "dbpedia", 
        "npg"
    ], 
    "username": "<EMAIL>"
}
"""
payload = '{"name":"<NAME>","rating":5,"tags":["dbpedia","npg"]}'
header={'Content-Type': 'application/json'}
r = requests.put("http://localhost:5000/user", data=payload, headers=header, auth=HTTPBasicAuth('<EMAIL>', 'kma123'))

print(r.text)

"""
Single/Bulk Question Request-
----------------------------

curl -X GET http://localhost:5000/question -H "Content-Type: application/json" -d '{"stats":"True"}' -u <EMAIL>:kma123
curl -X GET http://localhost:5000/question -H "Content-Type: application/json" -d '{"bulk":10,"stats":"True"}' -u <EMAIL>:kma123

[]

"""
payload = '{"bulk":10,"stats":"True"}'
header={'Content-Type': 'application/json'}
r = requests.get("http://localhost:5000/question", data=payload, headers=header, auth=HTTPBasicAuth('<EMAIL>', 'kma123'))

print(r.text)

"""
Submit Answer Request-
---------------------

curl -X PUT http://localhost:5000/answer -H "Content-Type: application/json" -d '{"value":"1","comment":"Just another comment","qid":"570eec1df6bf2d1e58a88479"}' -u <EMAIL>:kma123

{
    "message": [
        "Question not found for qid: ", 
        "570eec1df6bf2d1e58a88479"
    ]
}

"""

payload = '{"value":"1","comment":"Just another comment","qid":"570eec1df6bf2d1e58a88479"}'
header={'Content-Type': 'application/json'}
r = requests.put("http://localhost:5000/answer", data=payload, headers=header, auth=HTTPBasicAuth('<EMAIL>', 'kma123'))

print(r.text)
Register User - -------------  curl -X POST http://localhost:5000/user -H "Content-Type: application/json" -d '{"username":"<EMAIL>","password":"<PASSWORD>"}'   {     "Location": "http://localhost:5000/user/1",      "username": "<EMAIL>" } Login Registered User - ---------------------  curl -X GET http://localhost:5000/user -H "Content-Type: application/json" -d '{"duration":3600}' -u <EMAIL>:kma123   {     "token": {         "duration": 3600,          "value": "<KEY>"     },      "user": {         "name": "",          "rating": 5,          "tags": [],          "username": "<EMAIL>"     } } Update Registered User Profile- ------------------------------  curl -X PUT http://localhost:5000/user -H "Content-Type: application/json" -d '{"name":"<NAME>","rating":5,"tags":["dbpedia","npg"]}' -u <EMAIL>:kma123   {     "name": "<NAME>",      "rating": 5,      "tags": [         "dbpedia",          "npg"     ],      "username": "<EMAIL>" } Single/Bulk Question Request- ----------------------------  curl -X GET http://localhost:5000/question -H "Content-Type: application/json" -d '{"stats":"True"}' -u <EMAIL>:kma123 curl -X GET http://localhost:5000/question -H "Content-Type: application/json" -d '{"bulk":10,"stats":"True"}' -u <EMAIL>:kma123  [] Submit Answer Request- ---------------------  curl -X PUT http://localhost:5000/answer -H "Content-Type: application/json" -d '{"value":"1","comment":"Just another comment","qid":"570eec1df6bf2d1e58a88479"}' -u <EMAIL>:kma123  {     "message": [         "Question not found for qid: ",          "570eec1df6bf2d1e58a88479"     ] }