I am trying to create a Django app, one of the thing I do in that is write a connection.py which connects to a remote server. In that connection string I need to send one of the parameter as "http_auth = http_auth.HTTPBasicAuth(user, password)". I am not sure how to do that in Django. I searched the web a lot and nothing I got which is very relevant to what I am doing. Can anyone please help me.
If I understand you correctly, you want to connect to a service that uses HTTP Basic Auth in connection.py and do something with the data.
You might look into python's urllib2 library.
I found this snippet:
import urllib2, base64
request = urllib2.Request("http://api.foursquare.com/v1/user")
base64string = base64.encodestring('%s:%s' % (username, password)).replace('\n', '')
request.add_header("Authorization", "Basic %s" % base64string)
result = urllib2.urlopen(request)
Here:
-A