0

I am trying to extra some data under a login session using y. Usually when I intercept data I can view the format data in the network tab. In this login page, when the log on is submitted, I can't seems to find the format data tab.

https://lumen.ni.com/nicif/login.xhtml

Can anyone advice ?

My current implementation:

import y
from y import FormReuest

class LoginSpider(y.Spider):
name = 'example.com'


def start_requests(self):
    return [y.FormRequest("https://lumen.ni.com/nicif/login.xhtml",
                               formdata={'LoginForm:email': 'email', 'LoginForm:password': 'password'},
                               callback=self.logged_in)]

def logged_in(self, response):
    if("Please use correct email & password combination") in str(response.body):
        print("fail")
    else:
        data = {'p_part_number':'779494-01','p_duration':'','p_duration_uom':''}
        yield FormRequest(url="http://sine.ni.com/apps/utf8/nipp.purchase_form_ajax", formdata=data)

1 Answer 1

1

There are lots of other parameters they are using along with form, they are hidden in the login form, you need to send them too along with your request.

enter image description here

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

5 Comments

wow, thanks. I didn't noticed that there is a login.xhtml, I always checked xhr tab so didn't realize that's there. May I ask how to I get the information of the javax.faces.ViewStates to send along with form ?
As I said its in the login page, look for hidden input fields
Is it possible to do scraping past a /login while the /login is disallowed in the robots.txt?
@Mushirih yes its possible, set ROBOTSTXT_OBEY = False in settings.py
@Umair I have only one file which has all my code, tell me how to implement this flag

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.