Search This Blog

Showing posts with label Request. Show all posts
Showing posts with label Request. Show all posts

Sunday, April 12, 2020

Python Flask AttributeError: 'Request' object has no attribute 'is_xhr'

#. Remove flask and install recent version

    pip uninstall flask
    pip intall flask


#. Else, go to your requirements.txt remove the verions of your plugins/libraries.
   ex: flask=0.12.0
          to
         flask


Re run the requriements.txt and make sure all it is now in updated version.
#before uninstall manually and run the below command.

pip install -r requirements.txt


Monday, September 17, 2018

NodeJS - Request Plugin for file attachment MULTIPART/FORM-DATA

package.json

{
  "name": "sample",
  "version": "1.0.0",
  "description": "",
  "main": "apicall.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "dependencies": { 
    "request": "^2.83.0" 
  }
}



apicall.js

var fs = require("fs");
var request = require("request");

var fs = require('fs');
var request = require('request');
request.post({
    url: 'https://url/upload',
    formData: {
keyName1: 'value1',
                keyName2: 'value2',               
               file: fs.createReadStream('d:/temp/30off.jpg')
    },
}, function(error, response, body) {
    console.log(body);
});


steps

npm install
node apicall.js

Hit Counter


View My Stats