Skip to content

Commit

Permalink
Specify user-agent header when downloading Python builds
Browse files Browse the repository at this point in the history
This should allow Python devs to see how many people are using Pynsist.
  • Loading branch information
takluyver committed Sep 14, 2015
1 parent a28d216 commit 83c76f0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion nsist/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ def download(url, target):
"""
if isinstance(target, Path):
target = str(target)
r = requests.get(url, stream=True)

from . import __version__
headers = {'user-agent': 'Pynsist/'+__version__}
r = requests.get(url, headers=headers, stream=True)
r.raise_for_status()
with open(target, 'wb') as f:
for chunk in r.iter_content(chunk_size=1024):
Expand Down

0 comments on commit 83c76f0

Please sign in to comment.