Skip to content

Commit

Permalink
Merge pull request #26 from CiscoZeus/fix-path-joins
Browse files Browse the repository at this point in the history
Fix path joins
  • Loading branch information
victorfonsec4 committed Feb 8, 2017
2 parents 1f0785e + 337158a commit 6a30633
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
wheel
requests
wsgiref
wsgiref
8 changes: 5 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,19 @@

setup(
name='cisco-zeus',
version='0.2.2',
version='0.2.2.6',
description="Python client for CiscoZeus.io. It allows a user to post/query logs and metrics using Zeus.",
long_description=readme + '\n\n' + history,
author="Marc Solanas Tarre",
author_email='msolanas@cisco.com',
url='https://github.com/CiscoZeus/python-zeusclient.git',
packages=[
'zeus',
'zeus.interfaces',
],
package_dir={'zeus':
'zeus'},
package_dir={
'zeus': 'zeus',
},
include_package_data=True,
install_requires=requirements,
license="Apache License 2.0",
Expand Down
10 changes: 6 additions & 4 deletions zeus/interfaces/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import requests
from urlparse import urlparse
from urlparse import urljoin

METHOD_POST = 'POST'
METHOD_GET = 'GET'
Expand All @@ -33,14 +34,15 @@ def __init__(self, server):
self.server = ''.join(url_parts)

def _sendRequest(self, method, path, data=None, headers=None):
final_url = urljoin(self.server, path)
if method == METHOD_POST:
r = requests.post(self.server + path, data=data, headers=headers)
r = requests.post(final_url, data=data, headers=headers)
elif method == METHOD_GET:
r = requests.get(self.server + path, params=data)
r = requests.get(final_url, params=data)
elif method == METHOD_DELETE:
r = requests.delete(self.server + path)
r = requests.delete(final_url)
elif method == METHOD_PUT:
r = requests.put(self.server + path, data=data, headers=headers)
r = requests.put(final_url, data=data, headers=headers)

if r.status_code == 500:
raise Exception("Internal Server Error")
Expand Down

0 comments on commit 6a30633

Please sign in to comment.