import pbkdf2 import pyaes from pymongo import MongoClient import requests myclient =MongoClient("mongodb+srv://mynextfilm:mnf123@cluster0.ojasb.mongodb.net/myFirstDatabase?retryWrites=true&w=majority") db = myclient.DB collection = db['users_wallet_details'] def decryptionOfPrivate(privateKey,key): try: url_string = privateKey iv = 77423458040705335549997212640120530171624814583885731800099110782272387303263 passwordSalt = b"\xd3\x06b\xdf\xdc\xd1u\xd0V\xb2\xd8\xbci\xe9\xc8\r" password = key keyutf = pbkdf2.PBKDF2(password, passwordSalt).read(32) # ciphertext = encrypted url string aes = pyaes.AESModeOfOperationCTR(keyutf, pyaes.Counter(iv)) ciphertext = aes.decrypt(url_string) print(ciphertext) return ciphertext except: print("Somthing went worng") def getToDatabase(email, key): try: var = collection.find_one({'email': email} ) privatekey = var['private_key'] print(privatekey) decryptionOfPrivate(privatekey, key) return True except: print("something error") url = "http://127.0.0.1:8002/UploadFile" def datas(): payloadData = { "pravesh":"pravesh", "yameen":"yameen", "asha":"asha" } payloadStrData = str(payloadData) data ={ "user_id":1, "Module": "pravesh", "Services": "pravesh", "Project": 0, "Data": payloadStrData, "File":"asdfgh" } data2 ={ "File":"/home/user/mnf/project/MNF/blockchain/file.mp4" } response =requests.post(url,json=data2) print(response.json()) datas() # def data(): payloadData = { "pravesh":"pravesh", "yameen":"yameen", "asha":"asha" } payloadStrData = str(payloadData) data ={ "private_key":"0x6f06e1108b833b1918067042e13e60eda262705b80385a02d0330ce0db31d3ad", "user_id": 0, "Module": "string", "Services": "string", "Project": 0, } response =requests.get(url,params=data) print(response.json()) # data() # getToDatabase("pravesh3","MyNextFilm")