Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

add User-Agent

  • Loading branch information...
commit efad44abdaa842071d8323f62dcbb4929d585365 1 parent 5cc3634
Michael Ricordeau authored May 17, 2011

Showing 1 changed file with 6 additions and 2 deletions. Show diff stats Hide diff stats

  1. 8  src/plivo/rest/freeswitch/helpers.py
8  src/plivo/rest/freeswitch/helpers.py
@@ -103,6 +103,8 @@ def get_method(self):
103 103
 class HTTPRequest:
104 104
     """Helper class for preparing HTTP requests.
105 105
     """
  106
+    USER_AGENT = 'Plivo'
  107
+
106 108
     def __init__(self, auth_id ='', auth_token =''):
107 109
         """initialize a object
108 110
 
@@ -133,9 +135,11 @@ def _prepare_http_request(self, uri, params, method='POST'):
133 135
 
134 136
         if method and method == 'GET':
135 137
             uri = self._build_get_uri(uri, params)
136  
-            request = HTTPUrlRequest(uri)
  138
+            request = HTTPUrlRequest(uri, 
  139
+                             headers={'User-Agent': self.USER_AGENT})
137 140
         else:
138  
-            request = HTTPUrlRequest(uri, urllib.urlencode(params))
  141
+            request = HTTPUrlRequest(uri, urllib.urlencode(params),
  142
+                             headers={'User-Agent': self.USER_AGENT})
139 143
             if method and (method == 'DELETE' or method == 'PUT'):
140 144
                 request.http_method = method
141 145
 

0 notes on commit efad44a

Please sign in to comment.
Something went wrong with that request. Please try again.