Home > Blockchain >  How to get Body raw JSON data from Postman to Python
How to get Body raw JSON data from Postman to Python

Time:10-14

I have the variable colors and a value in the raw data in JSON format. I want to get the value from postman to python. How can I get the body raw data in python? That postman body raw data image -> colors raw data image

CodePudding user response:

You can request the data straight from the server with HTTP requests: https://requests.readthedocs.io/en/latest/

r = requests.get('192.168.1.6:8069/web/raw?default=red')
r.json()

Or export the data from postman in to a .json file and read the file using open()

with open('example.json', 'r') as myfile:
    data = myfile.read()

CodePudding user response:

I use the odoo tool developed by python. That odoo get raw data method little change the method. May be this way work in python

@http.route('/cams/biometrics 3.0/',method=["POST"], csrf=False, auth='public', type = "http")
def generate_attendance(self, **params):
    data = json.loads(request.httprequest.data)
    json_object = json.dumps(data)
  • Related