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

Implemented support for basic authentication #38

Closed
wants to merge 2 commits into from

Conversation

davehunt
Copy link
Member

@davehunt davehunt commented Nov 7, 2012

Fixes issue #36

@@ -50,7 +51,8 @@ class Scraper(object):
"""Generic class to download an application from the Mozilla server"""

def __init__(self, directory, version, platform=None,
application='firefox', locale='en-US', extension=None):
application='firefox', locale='en-US', extension=None,
username=None, password=None):
Copy link
Contributor

Choose a reason for hiding this comment

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

I would use a dict here with authentication as name. It should have username and password as properties.

@whimboo
Copy link
Contributor

whimboo commented Nov 9, 2012

Looks fine otherwise.

@davehunt
Copy link
Member Author

Updated

CHUNK = 16 * 1024
with open(tmp_file, 'wb') as f:
for chunk in iter(lambda: r.read(CHUNK), ''):
f.write(chunk)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice! Have found the same on stackoverflow. Ii just wonder if 16KB is the right amount of data we want to read-in for each iteration or if we should better go with 64KB, which I think is a better size.

Copy link
Member Author

Choose a reason for hiding this comment

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

we should better go with 64KB, which I think is a better size

Out of interest, what is this based on?

Copy link
Contributor

Choose a reason for hiding this comment

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

Previous experience. But it's a couple of years back so things could have changed. Values too small could cause an overhead while larger values could block the thread. I think we can leave it for now and figure out performance improvements later.

@whimboo
Copy link
Contributor

whimboo commented Nov 14, 2012

So please merge to patch to master. It looks fine!

@davehunt
Copy link
Member Author

davehunt commented Dec 4, 2012

Raised issue #43 to take care of the default=None items.

@davehunt
Copy link
Member Author

davehunt commented Dec 4, 2012

Landed in commit 44efef0

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.

2 participants