traffic layer api for python - google-api

I want to call google traffic layer api from a python code. so that i have to call traffic layer api as a inline call like that, i have to get the latest traffic update snapshot. can anyone help?
i tried this, but this returns static map. I know that traffic layer api is only available for js.
1st try =
url = 'https://mt0.google.com/vt?x='+str(start_x+x)+'&y='+str(start_y+y)+'&z='+str(self._zoom)
2nd try:
'http://maps.googleapis.com/maps/api/staticmap?center=12.955232,77.579923&size=600x600&zoom=17&sensor=false&layer=t&key=[my_secret_key]

Related

How to deploy a js web app that fetches data from an api

How can I deploy a js web application that uses an API.
I have hosted it on netlify but it doesn't fetch the data.
Everything works fine on localhost.
Link: hiuhu-theatre.netlify.app
In firefox you can see the request the function getMovies made was blocked, the console shows the reason, it links to this URL.
Basically you're trying to use http protocol for that request when you're over https in your website.
To fix that simply change your "http://www.omdbapi.com/” to start with "https://" instead.
Also, if you can, do not add API key to client side code, if you do so anyone can steal it and use it themselves (and that might make you pay more for the service or reach the limit you have really quick), instead do a request to your back-end server so it fetches the data while hiding the API key.
It works in local because you're using http in local aswell.
I've overrided the getMovies function in my browser to use https and it worked nicely

How to use REST API with FaunaDB?

I have created a collection in my Fauna database. I also made an index that returns all the data in that collection. I want to know if there is a way to get JSON REST API to work with this data. What I mean by this is I want a URL that I can 'GET' using XMLHttpRequest and then parse into JSON.
You might say that Fauna is "HTTP native". All of the language drivers (JS, C#, Python, etc.) are built on top of http requests. That is, there are no special connections or connection-pools to maintain. You can get pretty far with using the JS driver in the browser, for example, without using a server.
But to answer your question more directly, there are many ways to serve a REST API, and it is going to depend on how you want to serve the API.
Examples
AWS
Here is a blog post on how to set up a REST API with AWS App Runner, for example.
https://fauna.com/blog/deploying-a-rest-api-with-aws-app-runner-and-fauna
Vercel and Netlify
There are also some example apps on github that demonstrate using a REST API with
Vercel:
https://github.com/vercel/next.js/tree/canary/examples/with-cookie-auth-fauna
Or Netlify:
https://github.com/netlify/netlify-faunadb-example
Both of which host serverless functions for you to create a REST API.

geoserver allow only POST request in wms and wfs

I have some WFS and WMS layers published in geoserver and trying to access from my application. I want to ensure geoserver allows POST request only and block other like GET, PUT etc. I followed the link https://docs.geoserver.org/stable/en/user/security/service.html and changed rest.properties to include only POST method but still GET is allowed. Is there anything missing?
Changing the REST API will only prevent the normal usage of the REST API which will have no effect on WMS and WFS services.
Turning GET access off will prevent the vast majority of WMS clients from accessing your service as a GET request for a getmap endpoint is the standard way to get a WMS map. WFS clients will be less affected as the normal mode of operation is POST. In none of the current OGC services is PUT used so turning that off will have no effect.
Since (pretty much) the whole point of GeoServer is to allow the open and interoperable exchange of data there is no way to turn HTTP methods on or off for OGC services (WMS, WFS etc).
If you are trying to implement some sort of security by obscurity then this will probably not work (for long) and you should set up a proper security system on the getMap or getFeature methods as you need.
If you really (really) must try to cripple the service like this then you can probably do it using nginx or apache as a restricted front end and passing only the "right" requests to GeoServer.

GraphQL endpoint for file download

Is it possible to trigger a file download in a browser from the GraphQL endpoint on an apollo-server-express application?
I have the endpoint written in a standard express app.get function (see below) but I would like to make use of the GraphQL context for file download and so I'm wondering if it's possible to cause a download from a GraphQL endpoint.
Here's a bare-bones example of what I have on the express end in the app.get function:
app.get('/download-batch/:batchId', async (req, res) => {
res.send(new Buffer('test'));
});
Any help would me much appreciated. Thanks!
Yes, but you would be required to create a custom endpoint for that. You can't use the existing endpoint which you are using for making requests.
Using the custom endpoint, you have to add a middleware and process the data into a buffer or whatever format you need. But it would not be recommended. That would again become one more endpoint instead which you can write an API to serve that.(After all graphql is built mainly on the focus of single endpoint).
Boštjan Cigan mentions here some solutions and gives details about using GraphQL as a proxy with Minio. The backend would ask Mino to generate a temporary link that can be sent back to the browser for direct access.
This is a valid solution for many use cases.

Required Hep for Call 2 way connection and call using new REST API 1.1

We are using Call fire API in our application. We are moving to new REST API platform.
We need to connect / call with 2 numbers(two way connection).
With previous library we were using createClickToCallCampaign(key, callerid, transferNumber, awayMessage) and then sendConnection(APIKey, Convert.ToInt32(campaignId), OtherContactNo, info, Convert.ToInt32(CallFireDelayMins)
So as per this 2 way call gets connected. With new REST API platform how can we have 2 numbers connected? Please guide us.
Looking forward to proper helpful response.
take a look at our new API 2.0. SendCall operation should be what you are looking for https://developers.callfire.com/docs.html#sendCalls

Resources