Skip to content

support selector addition for form#20

Open
eamonnmag wants to merge 1 commit intoscrapy:masterfrom
eamonnmag:master
Open

support selector addition for form#20
eamonnmag wants to merge 1 commit intoscrapy:masterfrom
eamonnmag:master

Conversation

@eamonnmag
Copy link

@codecov-io
Copy link

codecov-io commented May 5, 2017

Codecov Report

Merging #20 into master will increase coverage by 0.97%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #20      +/-   ##
==========================================
+ Coverage   75.34%   76.31%   +0.97%     
==========================================
  Files           1        1              
  Lines          73       76       +3     
  Branches       18       19       +1     
==========================================
+ Hits           55       58       +3     
  Misses         16       16              
  Partials        2        2
Impacted Files Coverage Δ
loginform.py 76.31% <100%> (+0.97%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e61face...610d411. Read the comment docs.

Copy link
Member

@dangra dangra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good and useful, but please remove all print() calls.

def fill_login_form(url, body, username, password):
def fill_login_form(url, body, username, password, *args, **kwargs):

selector = kwargs.get('selector', '//form')
Copy link
Member

@dangra dangra May 17, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for **kwargs, extend function signature to:

def fill_login_form(url, body, username, password, selector='//form'):

url = args[0]
r = requests.get(url)
headers = {
'User-Agent': 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks useful but do you mind submitting this change in a different PR. I think it needs some extra thoughts like setting it from an command line flag that defaults to "Mozilla/4.0..."

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dangra Any thoughts on merging this PR, I am using this library in one of my projects, it will be very helpful for me if this feature is part of it.

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

Successfully merging this pull request may close these issues.

4 participants