urlrequest

Convert CURL to URLRequest

无人久伴 提交于 2021-02-04 19:46:06
问题 I’m trying to converting the the following curl request Swagger gives me to URLRequest: curl -X GET --header 'Accept: application/json' --header 'Authorization: key ttn-account-v2.<app-key>' 'https://<app-id>.data.thethingsnetwork.org/api/v2/query' URL and Headers are set correctly. Still I get the response: 401 - Not authorized. let key = "ttn-account-v2.<app-key>" let url = URL(string: "https://<app-id>.data.thethingsnetwork.org/api/v2/query") var request = URLRequest(url: url!) request

kivy Urlrequest with callback throws error on mobile, but not on laptop, why?

泄露秘密 提交于 2020-11-29 19:12:12
问题 The below is the COMPLETE code. The output when I run this below simple kivy code on my laptop is "Hello from Kivy Success". While the output when I run using buildozer android debug deploy run from ubuntu to my mobile is "Hello from Kivy Error". I even added cacert.pem in my project folder, used ca_file=where(),verify=True. That too didn't help. Why does UrlRequest fail on my mobile? Please help me with a solution. from kivy.app import App from kivy.uix.floatlayout import FloatLayout from

kivy Urlrequest with callback throws error on mobile, but not on laptop, why?

送分小仙女□ 提交于 2020-11-29 19:03:58
问题 The below is the COMPLETE code. The output when I run this below simple kivy code on my laptop is "Hello from Kivy Success". While the output when I run using buildozer android debug deploy run from ubuntu to my mobile is "Hello from Kivy Error". I even added cacert.pem in my project folder, used ca_file=where(),verify=True. That too didn't help. Why does UrlRequest fail on my mobile? Please help me with a solution. from kivy.app import App from kivy.uix.floatlayout import FloatLayout from

AS3 URLRequest Timeout (not AIR)

半城伤御伤魂 提交于 2020-02-25 05:03:39
问题 I am building a web-app that should send some data to the server. Flash has a built in timeout limit for URLRequest set to 30 seconds. I cannot use AIR (as this solution should run from the browser) and sometimes the request is for more than 30seconds. Flash ignores any data received after 30 seconds and sends an IO Error event although when I check the server, the script would have been executed. Is there any solution to modify the timeout limit? Maybe a smarter way? (any libraries to divide

AS3 URLRequest Timeout (not AIR)

核能气质少年 提交于 2020-02-25 05:02:14
问题 I am building a web-app that should send some data to the server. Flash has a built in timeout limit for URLRequest set to 30 seconds. I cannot use AIR (as this solution should run from the browser) and sometimes the request is for more than 30seconds. Flash ignores any data received after 30 seconds and sends an IO Error event although when I check the server, the script would have been executed. Is there any solution to modify the timeout limit? Maybe a smarter way? (any libraries to divide

POST URLRequest doesn't work in Swift 4

旧时模样 提交于 2020-01-24 01:36:06
问题 I want to use HTTP request to post an image on Imgur. I used Postman first to make sure my API logic is correct. Here is my setting for Postman ( myid is client id): This request succeeded, but the request failed in Swift with URLRequest and URLSession (Status Code: 400). var request = URLRequest(url: self.uploadURL!) request.httpMethod = "POST" request.setValue("Client-ID " + myid, forHTTPHeaderField: "Authorization") let data = "image=\(base64String)&type=base64".data(using: .utf8,

How do I fix this cross-domain ActionScript 3 error?

旧时模样 提交于 2019-12-30 06:45:28
问题 I'm going to be as specific and verbose as possible and include some of the code I'm using. I already did a search and found this question, which seems similar; however the author there was using ActionScript 2 instead of 3, and I couldn't seem to apply any of the answers given to my own situation effectively. I am trying to emulate (in a limited way) the behavior of JavaScript's XMLHttpRequest object through Flash/ActionScript 3, in order to overcome the same-domain limitation. But I'm

How do I fix this cross-domain ActionScript 3 error?

霸气de小男生 提交于 2019-12-30 06:45:27
问题 I'm going to be as specific and verbose as possible and include some of the code I'm using. I already did a search and found this question, which seems similar; however the author there was using ActionScript 2 instead of 3, and I couldn't seem to apply any of the answers given to my own situation effectively. I am trying to emulate (in a limited way) the behavior of JavaScript's XMLHttpRequest object through Flash/ActionScript 3, in order to overcome the same-domain limitation. But I'm

Unexpected Flash Security Exception When Using URLLoader

本小妞迷上赌 提交于 2019-12-29 07:43:11
问题 What I am trying to accomplish is to upload some binary data, specifically a ByteArray representing a PNG image, to a server using the URLLoader class in conjunction with URLRequest. When I set the contentType property of the URLRequest to 'multipart/form-data' instead of the default, the call to urlLoader.load() results in a security exception. When I leave the contentType property as the default, it works fine, but takes a long time (proportional to the length of the PNG file) to upload the

iOS swift post request with binary body

血红的双手。 提交于 2019-12-23 18:33:57
问题 I want to make a POST request from iOS (swift3) which passes a chunk of raw bytes as the body. I had done some experimenting which made me thought the following worked: let url = URL(string: "https://bla/foo/bar")! var request = URLRequest(url: url) request.httpMethod = "POST" request.httpBody = Data(hex: "600DF00D") let session = URLSession.shared let task = session.dataTask(with: request) { (data, response, error) in "DATA \(data ?? Data()) RESPONSE \(response) ERROR \(error)".print() }