Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Feature: Dont record specific request body #87

Open
danknittle opened this issue Apr 2, 2021 · 0 comments
Open

New Feature: Dont record specific request body #87

danknittle opened this issue Apr 2, 2021 · 0 comments

Comments

@danknittle
Copy link

Sometimes logging into a website requires posting form data as the request body and contains sensitive information which is recorded and printed during the tests.

Feature request to not record a specific Spider request body like

DONT_RECORD_REQUEST_BODY = [
    'DashboardSpider.login'
]

The AUTOUNIT_DONT_TEST_REQUEST_ATTRS pops the item from every request. Using this to pop the body attr would render all the tests useless and still records the sensitivity data.

class DashboardSpider(scrapy.Spider):

    def login(self, response):
        self.log.info("Login page... Posting username & password")
        token = response.css("input[name=_token]::attr(value)").get()
        formdata = {
            'user_name': os.getenv('USERNAME'),
            'user_password': os.getenv('PASSWORD'),
            '_token': token
        }
        return scrapy.FormRequest.from_response(response, formdata=formdata, callback=self.dashboard)

Thanks for your time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant