0

I currently have an application using Parse as a BaaS. I created a web crawler in Python because it's fairly simple and I'm hosting the code for that crawler on Heroku. My problem is I'm trying to call that Python script from an httpRequest in Parse Cloud Code using a POST request because a GET request is limited on the size of the data you can get back. Also, using a GET request works for fetching the page and running the code, I just don't get the data back. When I use a POST request I run into a problem with the Heroku server that says

    

Forbidden (403)

CSRF verification failed. Request aborted.

You are seeing this message because this HTTPS site requires a 'Referer header'

to be sent by your Web browser, but none was sent.

Here is my Cloud Code httpRequest on Parse (I'm not very familiar with requests so something is probably flawed on my side)

Parse.Cloud.httpRequest({
    method: 'POST',
    url: 'https://vast-basin-5892.herokuapp.com/',
    body: {
        beer: request.params.beer
    },
    params: {
        beer : request.params.beer
    },
    success: function(httpResponse){
        response.success(httpResponse.text);
    }, error: function(httpResponse){
        response.error(httpResponse);
    }
});

I have been struggling with this for several days and would appreciate any help.

2
  • It looks like this - stackoverflow.com/questions/9692625/… Commented Jan 15, 2016 at 12:36
  • I don't have a form in a template though. I just have a python script I'm trying to POST to. Commented Jan 15, 2016 at 18:18

1 Answer 1

1

You wrote : "GET request is limited on the size of the data you can get back" - it is't true. GET request has limit on size of data you can send.

Have you tried to send GET request?

Sign up to request clarification or add additional context in comments.

6 Comments

GET request does work on running the crawler, everything is fine in that respect, but when I try and get all the data my crawler returns via GET for some reason my Parse app doesn't get all the data back. Only when I return shorter text (which is actually what I'm returning in the crawler) will I actually receive it on Parse.
I actually just read about http methods at w3schools.com/tags/ref_httpmethods.asp and I think I misread it the first time I went through. Initially, I though it said you were limited on the data you got back because I though that data was returned in the url. but upon second inspection I think my initial thought was wrong and you can only send so much data because it goes in the url, but the data isn't returned in the url. So that must mean if the crawler works with a curl request then something must be wrong on the client side.
Ok, so i've got the httpRequest call to work with GET but it seems like I cannot get big results back. Basically what is happening is I search for a beer in a site and return the description I get back. The request works when the description is small, but when it's larger it doesn't work.
What type of data you are getting? Show your get request.
I'm just receiving a string back.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.