Error using Octave 4.0.2 to submit Coursera assignments

This is mistake:

curl: (1) Protocol "https" not supported or disabled in libcurl !! Submission failed: unexpected error: input file does not exist !! Please try again later. 

I am using Windows 10.

I see a possible answer here , but I do not know where this code will be added to Octave.

+5
source share
5 answers

URL changed. Use the new one in the submissionUrl () function in the lib / submitWithConfiguration.m file.

 function submissionUrl = submissionUrl() %submissionUrl = 'https://www-origin.coursera.org/api/onDemandProgrammingImmediateFormSubmissions.v1'; submissionUrl = 'https://www.coursera.org/api/onDemandProgrammingImmediateFormSubmissions.v1'; end 

To check the url you can use curl in the terminal.

 curl -k 'https://www.coursera.org/api/onDemandProgrammingImmediateFormSubmissions.v1' 

You should get something like {"message":"","statusCode":404}

With the wrong URL, you won’t get anything.

+7
source

Try using a patch that modifies the following lines in the submitWithConfiguration.m response function:

params = {'jsonBody', body};
% responseBody = urlread (submissionUrl, 'post', params); OLD CODE

[code, responseBody] = system (sprintf ('echo jsonBody =% s | curl -k -X POST -d @ -% s', body, submissionUrl));

d @ - receives data in a file on the current stdin (echo is filled).
-k allows curl to perform "insecure" SSL
(see curl --help)
NTN

===================
your code is the one I have, but I am W7.
Make another try by setting the quotation marks around the url to:
function submissionUrl = submissionUrl ()
submissionUrl =
' https://www-origin.coursera.org/api/onDemandProgrammingImmediateFormSubmissions.v1 "'; end

(use: '' and '' carefully, which will indicate "https: // .." on the command line.)

If this does not work, make a direct call to coursera with the command line (cmd):

curl -k " https://www-origin.coursera.org/api/onDemandProgrammingImmediateFormSubmissions.v1 "

This will cause coursera and, since there is no form submitted, the site will respond with an html page towards the end ... No action found ....

if that works, pb is probably not inside curl, but somewhere else. let us know.

+3
source

Change the following in submitWithConfiguration.m :

 curl -k -X POST 

to

 curl -k -XPOST 

and try again.

+1
source

Answer No. 1 had a typo, which was corrected in Answer No. 2.

Change: In function, function response = submitParts (conf, email, token, parts) Apply the following changes

  • Comment the line responseBody = urlread(submissionUrl, 'post', params);

  • Enter the following instead: [code, responseBody] = system(sprintf('echo jsonBody=%s | curl -k -XPOST -d @- %s', body, submissionUrl));

So the final function code looks like

 function response = submitParts(conf, email, token, parts) body = makePostBody(conf, email, token, parts); submissionUrl = submissionUrl(); params = {'jsonBody', body}; #responseBody = urlread(submissionUrl, 'post', params); [code, responseBody] = system(sprintf('echo jsonBody=%s | curl -k -XPOST -d @- %s', body, submissionUrl)); response = loadjson(responseBody); end 
+1
source

I just ran into this problem on Windows 10 today. In my case, the request was executed correctly, but the curl command by default displayed time information that discarded the validation logic in the send script.

Sending was successful, but if I printed the response line, it looked something like this:

 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 1562 100 548 100 1014 548 1014 0:00:01 --:--:-- 0:00:01 2082 100 1562 100 548 100 1014 548 1014 0:00:01 --:--:-- 0:00:01 2082 {"id":"Blablablabla","courseId":"Blablabla","itemId":"Blabla",...} 

I noticed that the curl command was used to execute the request, so I added the --silent flag to the code that creates the curl command to execute in submitWithConfiguration.m (in my case, line 134).

 % use urlread or curl to send submit results to the grader and get a response function response = getResponse(url, body) % try using urlread() and a secure connection params = {'jsonBody', body}; [response, success] = urlread(url, 'post', params); if (success == 0) % urlread didn't work, try curl & the peer certificate patch if ispc % testing note: use 'jsonBody =' for a test case json_command = sprintf('echo jsonBody=%s | curl --silent -k -X POST -d @- %s', body, url); % ^^^^^^^^ this right here!! else % it linux/OS X, so use the other form json_command = sprintf('echo ''jsonBody=%s'' | curl --silent -k -X POST -d @- %s', body, url); end % get the response body for the peer certificate patch method [code, response] = system(json_command); % test the success code if (code ~= 0) fprintf('[error] submission with curl() was not successful\n'); end end end 

Now the answer looked more reasonable:

 {"id":"Blablablabla","courseId":"Blablabla","itemId":"Blabla",...} 

And the sending is completed successfully.

0
source

All Articles