I need to convert a file to readable stream to upload through api, there is a node js example which uses fs.createReadStream. Can any body tell me what is python equivalent of the aforesaid statement ?
example
const axios = require('axios');
const fs = require('fs');
const FormData = require('form-data');
export const pinFileToIPFS = (pinataApiKey, pinataSecretApiKey) => {
const url = `https://api.pinata.cloud/pinning/pinFileToIPFS`;
//we gather a local file for this example, but any valid readStream source will work here.
let data = new FormData();
data.append('file', fs.createReadStream('./yourfile.png'));
How can i replicate above in pythonic way?