Wednesday, 11 September 2013

Fetch data of Android POST in django server

Fetch data of Android POST in django server

I am trying to send POST request fro android to Django server and trying
to execute the data
Android HTTP POST request
HttpClient httpclient = sslClient(new DefaultHttpClient());
HttpPost post = new HttpPost("https://www.zzz.com/bulk-loc-add");
List<NameValuePair> pairs = new ArrayList<NameValuePair>();
pairs.add(new BasicNameValuePair("bulkData", params[0]));
Log.v(TAG,"" + params[0]);
post.setEntity(new UrlEncodedFormEntity(pairs));
HttpResponse response = httpclient.execute(post);
On my django Server i am writing
views.py
@csrf_exempt
def bulk_loc_add(request):
print request.method
bulk_data = request.POST
print bulk_data
Bulk = request.GET
print Bulk
request.method when i am printing its giving me GET rather than POST and
when i am doing request.POST or request.GET its giving me blank QueryDict:
{} i am not getting why it is blank i have seen my eclipse Logs data is
there.

No comments:

Post a Comment