Permalink
Browse files

add User-Agent

  • Loading branch information...
1 parent 5cc3634 commit efad44abdaa842071d8323f62dcbb4929d585365 @tamiel tamiel committed May 17, 2011
Showing with 6 additions and 2 deletions.
  1. +6 −2 src/plivo/rest/freeswitch/helpers.py
@@ -103,6 +103,8 @@ def get_method(self):
class HTTPRequest:
"""Helper class for preparing HTTP requests.
"""
+ USER_AGENT = 'Plivo'
+
def __init__(self, auth_id ='', auth_token =''):
"""initialize a object
@@ -133,9 +135,11 @@ def _prepare_http_request(self, uri, params, method='POST'):
if method and method == 'GET':
uri = self._build_get_uri(uri, params)
- request = HTTPUrlRequest(uri)
+ request = HTTPUrlRequest(uri,
+ headers={'User-Agent': self.USER_AGENT})
else:
- request = HTTPUrlRequest(uri, urllib.urlencode(params))
+ request = HTTPUrlRequest(uri, urllib.urlencode(params),
+ headers={'User-Agent': self.USER_AGENT})
if method and (method == 'DELETE' or method == 'PUT'):
request.http_method = method

0 comments on commit efad44a

Please sign in to comment.