http-post

Async HTTP post android

帅比萌擦擦* 提交于 2019-12-29 07:16:11
问题 I am using an application where i just need to download a pair of coordinates for google maps from a mysql server. I can do this successfully using php and a normal httpost but my app freezes for a few seconds when i do it. I read that you need to make httppost asycronous in order to avoid that freezing until the server finishes the prossess and sends the results. The point is that i need that results in a json array like the normal httpost. For example if i had this httppost. HttpClient

MVC - Editing a list of objects

半世苍凉 提交于 2019-12-28 17:42:08
问题 I have the following class layout in MVC: public class ReportModel { List<SomeItem> items; string value; string anotherValue; } now I create a strongly typed view in MVC of this type and make editable text fields to edit each value as well as use a foreach loop to populate text fields to edit the items in the list of someitem. when I submit to the httppost method the singular values come back fine in the reportmodel object but the list does not get returned in the object. How should this be

TypeError: b'1' is not JSON serializable

↘锁芯ラ 提交于 2019-12-28 13:42:11
问题 I am trying to send a POST request as JSON. *email variable is of type "bytes" def request_to_SEND(email, index): url = "....." data = { "body": email.decode('utf-8'), "query_id": index, "debug": 1, "client_id": "1", "campaign_id": 1, "meta": {"content_type": "mime"} } headers = {'Content-type': 'application/json'} try: response = requests.post(url, data=json.dumps(data), headers=headers) except requests.ConnectionError: sys.exit() return response I get the error: File "C:\Python34\lib\json

Send FormData with other field in Angular

∥☆過路亽.° 提交于 2019-12-27 17:39:50
问题 I have a form with two input text and one upload . I have to send it to the server but I have some problem concatenating the file with the text. The server expects this answer: "title=first_input" "text=second_input" "file=my_file.pdf" This is the html : <input type="text" ng-model="title"> <input type="text" ng-model="text"> <input type="file" file-model="myFile"/> <button ng-click="send()"> This is the Controller : $scope.title = null; $scope.text = null; $scope.send = function(){ var file

How to use parameters with HttpPost

穿精又带淫゛_ 提交于 2019-12-27 13:39:26
问题 I am using a RESTfull webservice with this methode: @POST @Consumes({"application/json"}) @Path("create/") public void create(String str1, String str2){ System.out.println("value 1 = " + str1); System.out.println("value 2 = " + str2); } In my Android app I want to call this method. How do I give the correct values to the parameters using org.apache.http.client.methods.HttpPost; I have noticed that I can use the annotation @HeaderParam and simply add headers to the HttpPost object. Is this the

How to take data in google sheet script via POST request in JSON format?

六月ゝ 毕业季﹏ 提交于 2019-12-26 12:34:09
问题 This question is about receiving POST request from somewhere. I'm looking for a google sheet script function that can take and handle data from the POST request in JSON format. Could you suggest any example? The POST request is here: https://script.google.com/macros/s/BOdirjv45Dn6FHrx_4GUguuS6NJxnSEeviMHm3HerJl4UsDBnDgfFPO/ { "p1": "writeTitle", "p2": [[URL]], "p3": [[PIC_A]], "p4": [[PIC_B]], "p5": [[TITLE]] } application/json doPost() doesn't work: doPost(e) { var json = JSON.parse(e

How to take data in google sheet script via POST request in JSON format?

怎甘沉沦 提交于 2019-12-26 12:34:07
问题 This question is about receiving POST request from somewhere. I'm looking for a google sheet script function that can take and handle data from the POST request in JSON format. Could you suggest any example? The POST request is here: https://script.google.com/macros/s/BOdirjv45Dn6FHrx_4GUguuS6NJxnSEeviMHm3HerJl4UsDBnDgfFPO/ { "p1": "writeTitle", "p2": [[URL]], "p3": [[PIC_A]], "p4": [[PIC_B]], "p5": [[TITLE]] } application/json doPost() doesn't work: doPost(e) { var json = JSON.parse(e

Android HTTP Request for CakePHP URL

﹥>﹥吖頭↗ 提交于 2019-12-25 18:25:37
问题 I have a website which was created with cakephp. I want to pass some values formed in my App to this website. When I enter the exact same URL in the browser it works. The URL is something like: www.something.com/function/add/value So I'm very confused if this is a GET or a POST method? And how I can do that? The thing is that I can NOT change this URL or put some POST or GET PHP script there to get the values. So I basically just have to call the URL with those params. This is my code:

Classic ASP HTTP Post from another server

天大地大妈咪最大 提交于 2019-12-25 18:17:35
问题 I am litte confused, i want to protect one page in classic asp from being accessed by Get Method. Is it possible that someone can post data from another server to my page? If Yes, how to detect that and allow only post from my server. Thanks for help. 回答1: If you are currently using Request("ParameterName") to retrieve parameters then you should change to Request.Form("ParameterName") which will only get the parameter if it was POSTed. Alternatively you can lookup the method used to access

How can I do POST request in django?

我的梦境 提交于 2019-12-25 17:38:52
问题 with exception of requests , are there other ways for doing a POST HttpRequest? I CAN ONLY USE DJANGO LIBS, so I cannot import requests . In particular, I would like to pass the username and the password in the post request. something like: data = { "username": "user", "password": "pass", } r = request.POST( data ) (please note that this code is just an example) Anyone knows? note: I'm using python 2.7 回答1: You didn't set url. data = { "username": "user", "password": "pass", } URL = 'http:/