CopyPastor

Detecting plagiarism made easy.

Score: 0.8073480561077908; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2018-08-02
by Syed Faizan

Original Post

Original - Posted on 2014-03-21
by Martijn Pieters



            
Present in both answers; Present only in the new answer; Present only in the old answer;

If upload_file is meant to be the file, use: files = {'upload_file': open('file.txt','rb')} values = {'DB': 'photcat', 'OUT': 'csv', 'SHORT': 'short'} r = requests.post(url, files=files, data=values) and requests will send a multi-part form POST body with the upload_file field set to the contents of the file.txt file. The filename will be included in the mime header for the specific field: >>> import requests >>> open('file.txt', 'wb') # create an empty demo file <_io.BufferedWriter name='file.txt'> >>> files = {'upload_file': open('file.txt', 'rb')} >>> print(requests.Request('POST', 'http://example.com', files=files).prepare().body.decode('ascii')) --c226ce13d09842658ffbd31e0563c6bd Content-Disposition: form-data; name="upload_file"; filename="file.txt" Note the filename="file.txt" parameter.
If `upload_file` is meant to be the file, use:
files = {'upload_file': open('file.txt','rb')} values = {'DB': 'photcat', 'OUT': 'csv', 'SHORT': 'short'}
r = requests.post(url, files=files, data=values)
and `requests` will send a multi-part form POST body with the `upload_file` field set to the contents of the `file.txt` file.
The filename will be included in the mime header for the specific field:
>>> import requests >>> open('file.txt', 'wb') # create an empty demo file <_io.BufferedWriter name='file.txt'> >>> files = {'upload_file': open('file.txt', 'rb')} >>> print(requests.Request('POST', 'http://example.com', files=files).prepare().body.decode('ascii')) --c226ce13d09842658ffbd31e0563c6bd Content-Disposition: form-data; name="upload_file"; filename="file.txt" --c226ce13d09842658ffbd31e0563c6bd--
Note the `filename="file.txt"` parameter.

        
Present in both answers; Present only in the new answer; Present only in the old answer;