POST request via requests (python) not returning data -


There is one more question about my post. This post should be the same referenced on the stack overflow by using 'request.post' to post multipart form data by Python ', but for some reason I can not work it's website I posted a file I want to do that which is already in FastAffate on this website and using the requests in Python, select the 'SVM' option. It is based on the fact that @NorthCat had given me first, which used to work as a magic: import request import urlib file = {'file' :( open ('bishop / newdenovo2 .txt ',' R ') Read ())} url =' http://www.camp.bicnirrh.res.in/predict/hii.php 'payload = {"algo []": "svm"} Raw = urllib.urlencode (payload) response = session.post (url, files = file, data = payload) print (response.text)

Since it is not working, It was felt that the payload problem was I was playing with Payload, but I can not get it for any of these works.

  payload = {'S1': straw (data), 'filename': '', 'algo []': 'svm'} # where i just read the file, 'Data' payload = {'SVM': 'SVM'} is not actually in the # header, but I also tried to do it) Payload = {'S1': '', 'Elgo []': 'SVM ',' B1 ':' Submit '}   

None of these payloads resulted in data.

Any help is appreciated. Thanks a lot!

You must set the file post variable name to "userfile", that means

  file = {'userfile': (open 'Bishop / NewDenovo .2.txt', 'r'). Read ())}   

Note that Read () is unnecessary, but this file does not succeed in upload. Here are some code that should work for you:

  import request session = requests. Session () response = session.post ('http://www.camp.bicnirrh.res.in/ (' Fasta.txt ',' text / plain ')}, data = {' algo [] ':' svm ',' Prediction / hii.php ', files = {' userfile ': (' fasta.txt '})   

response.text has HTML results Save it in a file and view it in your browser or parse it in some way and remove the result.

In this request I have specified the mime type of "text / plain" for the file. Not necessary, but it is not necessary for the documentation And the recipient can help the server.

The contents of my fasta.txt file are:

  & gt; 24.6 Jasd2ktut गत्तगत्तगक्सक्सत्तक्सगतगक्सगागक्साकगकत्तागतगगक्सगकक्टग्गग्गग्तैग्गतसगकागैटाआक्टकाअगगत्तगैग्ग्ग्गैक्सगकाकागकगकगगगकगतगतग्गत्तत्तत्तकगतगकगकगकगंगाक्सत्तैक्टग्ग्ग्कत्तगकतगकतातकगक्यासैक्सतगाअगगगगतगक्स्टक्सत्तक्ग्ग्गैगगतगककगगसतगकटगगकतगतकगतसागकट्सगतगतकगतगगतगत्तग्ग्गत्तागतकक्कगकाकगगकगकाकक्सक्टगतक्कत्तगत्तगतततकताग्गागैतगक्सगगगकाॅक्सगगगगगगतगगगगगकगतसागतसागसत्गगक्टक्टतकगतकगगगकताकाकातकगकताकातग्गक्सगत्तकागतगगतगककककगसगगगतगगगकगतकतकआगगकगगसक्टकगत्तक्यागत्तगकैटस्टगकाकक्सगगतगसतगागतकगगगत्तगकतागटाक्कगकगतगतकाGCATAGCGCGGTGAATATGTTCCCGGGTCTTGTACACACCGCCCGTCACGTCATGGGAGCCGGCAACACTTCGAGTCCGTGAGCTAACCCCCCCTTTCGAGGGTGTGGGAGGCAGCGGCCGAGGGTGGGGCTGGTGACTGGGACGAAGTCGTAACAAGGT    

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -