is there a way to make asynchronous batch requests using java sdk? The docs show some examples using curl only. Does anyone have a java example?
BatchRequest batchRequest = new BatchRequest(context);
// adding some requests
request.addToBatch(batchRequest1);
request.addToBatch(batchRequest2);
request.addToBatch(batchRequest3);
List<APIResponse> batchResult = batchRequest.execute(); <-- How to async?
Related
The aws repo https://github.com/awslabs/amazon-kinesis-video-streams-webrtc-sdk-js provides the backend code to generate a presigned url.
I was able to log it and it looks like this (modified by adding/removing some characters to avoid misuse):
wss://v-7bd53a347.kinesisvideo.ap-south-1.amazonaws.com/?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-ChannelARN=arn%3Aaws%3Akinesisvideo%3Aap-south-1%3A3514502525359%3Achannel%2Fwebcam-signalling-channel-4%2F1637856477339&X-Amz-ClientId=U5PAWCWS5VE&X-Amz-Credential=ASIAVDVAVN2XSBEJVNOK%2F20211207%2Fap-south-1%2Fkinesisvideo%2Faws4_request&X-Amz-Date=20211207T160335Z&X-Amz-Expires=299&X-Amz-Security-Token=IQoJb3JopZ2luX2VjEND%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaCmFwLXNvdXRoLTEiRzBFAiEA50TmitWwvooci6xG3i1M4jGzt7c7lfEu36TcdzOOFm8CIBNZLLDLB%2FDiBGIkU1PymctAcnobgu4WX%2F4KptvG%2BTOjKtMECKn%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEQAhoMMzUxNDUwNTI1MzU5IgzlJEvF6NfKu43Rf70qpwRckEnOpVflPcE%2FvLtSXqgUCDI5qE5F9RUSpqtVKEA0Q6qPClsXw9IJMx2PWWQdgQ5I2uuMG1Ql1EH5DbY%2Fac0%2B%2BXWUJnPeHjDvpuNRk4J52YWAO02s4692U0EayCJsyxD57z5OKuQ8y9xkfjd60juMqJ8QUX1NsRgx10OJvxEbQh8Fou2N9qJeJokSrLOD6bCIRZdJQ%2FLzg6q7HdR5oqnNTMHNv7sJ0gmcxF7UhT0wS%2FuIcEtyNBo%2FyE1NI0ytgXVic6R7Pe4wSyzIn76W2x98I3OrbPa67vq3NzyJK1h%2F%2FqhfqNFPOaBP7eFGxcVWRPqz2VOknNtMD3b8QFZV2HwwnLBUXv2Dgp3Ez%2Fl%2F06hnAwHARStNtpP3ZX1maJE%2FBK52tRP%2BAWG1mv5wNodPWNAj%2B%2B04Obn91%2BjmAUc6ntXLWbZLUUuAtS8RSYDkX41ZA%2BnKTPZusBjh5vxW8A8fa3YKl33b4T9QT5eTWqNq9EXeI51Vd6mZsWh9kgEF768MSDn3hfTTIhFienuErO6N5wPWzOVp71aUgJS95Y2LTffOocP3CL3daCaYiEvzA%2FolDXwRzTqYRK6MwlqeAGjREmIoYjb11K4kU8mtHfDAKq5c1JA4cW719WBAoiQsxRO0egcFuskkGSCiAEaMAbg94eSnHpFLmPWYJwHj61eBU4JzIUsmzhxLF5x4MADUjxf1yOTRyx3FhIiO51gutW1fbgTt7z9lPn9szDXi76NBjqFAiE7AMy1zOl4hnXhjO60JRiKgHL0YuKsHJPAV02UmAdgf7lY%2Bl14ABncq4q1HSv%2BRKA2rr1ZM9JfgjMGHD0Xw9a8qFjN0RX5N%2FMw0F5nvVV9oGC8lYmT%2BLwW7DfyinSIA30SMzfXVfIEcGhEil900hoZMQZyvOWM4q7F%2Bye%2FN4%2FzS1RqMNHQGIT%2FdgOZkSJwyho6cpH1kEZXZMfhlWjOnTBjcqQzGYd9g9GLocDq8ZivrAKCtEM6yR%2Bh%2FsLhtGinqpsVFM%2BhaxK9G929tvlIQ3ZxA4GRAuTBepucoeVhmOwWv0f%2Fk82xjET%2FD5zVYvtMEpoU76aPal7pYNis98DspPB9ugrAw%3D%3D&X-Amz-Signature=8303b836351e231e9e7850cdd565a21073eaa4cb699b06d50c9e7f7e15a933e&X-Amz-SignedHeaders=host
I am not able to understand how to use it in the frontend to view the video stream.
I have come across other comments seeking examples but there are no responses:
How to use Kinesis Video Stream WebRTC SDK in the browser without providing credentials?
Has anyone been able to use it?
In case you are still looking for an answer, the signed url can be used while creating a signalling client in the front end code and can be used for connecting with AWS WebRTC Signalling service. You may find an example at below
https://blog.learningdollars.com/2021/05/09/aws-kinesis-video-stream-with-signed-url/
I implemented the above but was unable to see request from one front-end module to the other front-end module using AWS Kinesis WebRTC.
Can someone please explain how to send notification with Payload for Chrome using Python/Django
I am doing so-
fcm_url = "https://fcm.googleapis.com/fcm/send"
encoded = WebPusher(subscription_info).encode(json.dumps(data))
crypto_key = "dh=" + encoded["crypto_key"]
salt = "salt=" + encoded['salt']
headers = {'Authorization': 'key=' + gcm_key, 'Content-Type': 'application/json', }
headers.update({'crypto-key': crypto_key, 'content-encoding': 'aesgcm', 'encryption': salt})
fcm_data = {"raw_data":base64.b64encode(encoded.get('body')), "registration_ids": ['eYXdX1V94XY:APA91bHPQdnlQiVwe5HmWnRQrtpOnHzAJ4kEHNgB8GrEZ_YxSgtwz-0gvcpUFBAb3_eVXOVcJAjvVotGfKl9jLGM_X6nZb76YzFBZazMu1auIDAXhXjUgFDHm7E2ffRpBD70rpD1qC1r']}
resp = requests.post(fcm_url,data=json.dumps(fcm_data),headers=headers)
Output:-
{"multicast_id":6483153199368608385,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"0:1481362362576359%958b01adf9fd7ecd"}]}
but the notification doesn't contain the above specified Data.
It looks like you are mixing the Web Push Protocol and the Firebase Cloud Messaging API.
Are you trying to send a request to a normal open web PushSubscription, or are you trying to send to a Firebase token?
If you are using the Firebase Messaging SDK for web, then you don't need to encrypt the payload (It's one of the main reasons for using the firebase messaging SDK).
If you are using just the normal open web API's and not touching the Firebase Messaging SDK, I'd check out: https://github.com/web-push-libs/pywebpush
I have an website in Django that is using the REST framework to provide an API.
Is there a way to generate an API client that can be used to communicate with this API that provides objects mapping the contents of the API?
If you're talking about a javascript client API, I have a django management task that I use to generate a javascript library from my DRF API
using AngularJS 1.*. I'm still using DRF 2.4, for easy nested object writes, and Django 1.7. Here it is as a github gist
Take that file, stick it in <app>/management/commands/ and call it like:
python manage.py rest_framework_2_js rest_api.gen.js [base_factory_name] [server_base_url]
If your base_factory_name was foo and you had an API object at server_base_url/Bar/ named Bar, you would use it like:
foo.Bar.get(42)
.then(function(bar_inst) {
console.log(bar_inst);
bar_inst.baz = 77;
bar_inst.save()
.then(function() {
console.log('bar_inst has been saved');
});
})
or
foo.BarList.get('filter_a=5&field_filter_b=abc,d')
.then(function(data) {
console.log(data.results);
})
Each instance in the data.result will be a foo.Bar instance.
You can add callbacks before sending to the server and after retrieving from the server using foo.Bar.pre_save(function (inst) {/*callback mutator*/}) and foo.Bar.post_restore( function(inst) { /*callback mutator*/}).
Anyways, this management task is not productized and it has only one user - me, but I have been using it for 2 years and it works great for me :-) We can work to get it working in your configuration if you like. Naturally the biggest caveat is the AngularJS 1.* dependency.
I'm new in this environment and I want to create my first red app, But I need some help to connect the web services for sabre , Can you help me with a example for starting in this? I have instaled the Eclipse RCP that sabre has in their page and configured it, but dont have an idea of how to start.
Thank You very much.
I would suggest the com.sabre.redapp.example.cf.sws RedApp that comes bundled on the RedApp SDK samples folder.
Mainly, for consuming Sabre WebServices, you'll be using Communication Framework classes from RedApp SDK, which allows u to consume the services without being worried with low level communications, that is, most of your development efforts will be to create and parse the XML payloads, consuming the services using java is very straightforward :
// Set actionName to the correct Sabre Web Services action name
String actionName = "OTA_AirAvailLLSRQ***";
// Retrieve a reference to ISRWCommunication
ISRWCommunication com = Activator.getDefault().getServiceReference(ISRWCommunication.class);
// Create the request
SWSRequest request = new SWSRequest();
request.setAction(actionName);
request.setPayload(payload);
// Send the request
SWSServiceClient client = new SWSServiceClient(com);
ClientResponse <SWSResponse> rsp = client.send(request);
// Retrieve the response
if (rsp.isSuccess()) {
SWSResponse response = rsp.getPayload();
// Response for the sent request
Document responsePayload = response.getResponse();
}
*** don't forget to Authorize the service usage on redapp.xml file :
<Authorization name="com.sabre.edge.cf.sws.SWS" metric="tpm">
<Action name="OTA_AirAvailLLSRQ" threshold="3" />
</Authorization>
We are migrating from #task to Rally and trying to change my REST api calls to work under Rally.
I am having trouble finding the syntax for sending the username/password via cfhttpparam for the purpose of getting the Rally SecurityToken.
My end result would be pulling the Rally hours by resource over a given time period.
i have found several curl examples but cant get a translation to work in ColdFusion using cfhttp