Skip to content

Commit

Permalink
Use requests module instead of urllib
Browse files Browse the repository at this point in the history
  • Loading branch information
dlanderson authored and Chris Schneider committed Feb 13, 2018
1 parent 60aca3e commit 5b1c610
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
language: python
python:
- "2.7"
- "3.3"
- "3.4"
- "3.5"
- "3.6"
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
psutil
PyYAML
requests
13 changes: 11 additions & 2 deletions scout_apm/core_agent_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,22 @@
# x sha256sum the downloaded file, compare to metadata
# x launch - how?

# Python Built-Ins
import hashlib
import platform
import tarfile
import urllib.request
import subprocess
import tempfile
import json
import atexit
import shutil


# 3rd Party
import requests


# APM Modules
from scout_apm.context import agent_context
from scout_apm.socket import CoreAgentSocket
from scout_apm.commands import CoreAgentVersion, CoreAgentVersionResponse, CoreAgentShutdown
Expand Down Expand Up @@ -131,7 +137,10 @@ def download_package(self):
print('Downloading: {full_url} to {filepath}'.format(
full_url=self.full_url(),
filepath=self.package_location))
urllib.request.urlretrieve(self.full_url(), self.package_location)
req = requests.get(self.full_url(), stream=True)
with open(self.package_location) as f:
for chunk in req.iter_content(1024 * 1000):
f.write(chunk)

def untar(self):
t = tarfile.open(self.package_location, 'r')
Expand Down
7 changes: 3 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from setuptools import setup

setup(name='scout_apm',
version='1.0.0a2',
version='1.0.0a3',
description='Scout Application Performance Monitoring Agent',
long_description='Scout Application Performance Monitoring Agent',
url='https://github.com/scoutapp/scout_apm_python',
Expand All @@ -10,8 +10,8 @@
license='Proprietary',
packages=['scout_apm'],
zip_safe=False,
python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, <4',
install_requires=['PyYAML', 'psutil'],
python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4',
install_requires=['psutil', 'PyYAML', 'requests'],
keywords='apm performance monitoring development',
classifiers=[
'Development Status :: 3 - Alpha',
Expand All @@ -24,7 +24,6 @@
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
Expand Down

0 comments on commit 5b1c610

Please sign in to comment.