andrewgross / pyrelic

New Relic Python API
MIT License
21 stars 11 forks source link

Update pyrelic to work with newer versions of requests lib #4

Closed rgooler closed 11 years ago

rgooler commented 11 years ago

Looks like requests 1.0 and greater broke a lot of stuff.

Traceback (most recent call last):
  File "/usr/lib/nagios/plugins/check_nr_error_rate.py", line 98, in <module>
    for threshold in nr.get_threshold_values(opts.appid):
  File "/usr/lib/nagios/plugins/check_nr_error_rate.py", line 59, in get_threshold_values
    response = self._make_get_request(uri)
  File "/usr/local/lib/python2.7/dist-packages/pyrelic/__init__.py", line 128, in _make_get_request
    return self._make_request(requests.get, uri, params=parameters, timeout=timeout)
  File "/usr/local/lib/python2.7/dist-packages/pyrelic/__init__.py", line 80, in _make_request
    response = request(uri, config=self.config, headers=self.headers, proxies=self.proxy, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 55, in get
    return request('get', url, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 44, in request
    return session.request(method=method, url=url, **kwargs)
TypeError: request() got an unexpected keyword argument 'config'```

However, if I install requests-0.14.2 (last version before 1.0), everything works.
andrewgross commented 11 years ago

Indeed, I wrote this before requests-1.0 came out, and it had a lot of backwards incompatible changes. My plan for now is:

andrewgross commented 11 years ago

Quick update.

  1. New Version has been released as 0.3.0 on PyPi
  2. Doing a large refactor which includes updating requests here. Additionally I have removed the lxml dependency in favor of etree. Due to the popularity of etree and requests, I am going to be embedding the versions used in this library to make it more palatable for distribution.
  3. I'll set up Travis integration as soon as I finish adding tests for the last few tests in Client and reach 100% coverage.

The next step will be to review the remaining unimplemented methods from their API / TODO's and decide whether they should be added before 1.0.

andrewgross commented 11 years ago
  1. was a lie, I just put it on travis. https://travis-ci.org/andrewgross/pyrelic/jobs/6972097
rgooler commented 11 years ago

Awesome, this saves me a good bit of time. I'll let you know how it works in the next few days when I get a chance to integrate it!

On Tue, May 7, 2013 at 3:08 PM, Andrew Gross notifications@github.comwrote:

  1. was a lie, I just put it on travis. https://travis-ci.org/andrewgross/pyrelic/jobs/6972097

— Reply to this email directly or view it on GitHubhttps://github.com/andrewgross/pyrelic/issues/4#issuecomment-17573941 .

andrewgross commented 11 years ago

Pushed 0.4.0 to work with requests 1.2.0

I'll release the embedded version soon