I am developing model to calculate origin to destination using Python3. I tried google-maps-services-python from github and obtain an error.
[API Key already enabled][1]
ApiError: REQUEST_DENIED (This API project is not authorized to use this API. Please ensure this API is activated in the Google Developers Console:)
However the same key I tried work as http request over browser.
The API key did not apply any key restriction
[API key did not apply any key restriction][2]
Any idea what need to be done?
Solution
In order to make it direct query from IPython, you need both API enabled.
-Google Maps Directions API
-Google Maps Geocoding API
Thanks problem solved.
Related
I’m having some problems using the google geocode API. I don't know if the paying system has changed recently but I can only use the geocode.geolocation statement once a day.
When I use a gmap.geocode function using my api key, I get the correct return value but after that, I get a Timeout error. Is this something that can be changed in my local settings or is the geocode API actually restricted to one request a day? Using the following code,
import googlemaps
key='**********************'
gmap=googlemaps.Client(key=key)
print(gmap.geocode('서울중부경찰서',language='ko'))
I get an error like
raise googlemaps.exceptions.Timeout()
Timeout
Turns out google's price plans changed and the geocoding api is still provided free until a quite amount of requests, but you have to register a payment method(credit card) to use the api.
I'm trying to use graph REST api / python of AzureAd.
I'm logged in with service principal.
Is it possible to list users/groups which has access to enterprise application?
If so: How?
Look in the RestAPI if you found what you need:
https://msdn.microsoft.com/Library/Azure/Ad/Graph/api/api-catalog
If you don't find it, it's likely not possible. If you found it, this RestAPI is exposed in Python by the azure-graphrbac package:
https://pypi.python.org/pypi/azure-graphrbac
https://learn.microsoft.com/python/api/overview/azure/activedirectory
If you found it in the RestAPI, but not in the Python package, open an issue for support to the endpoint your need:
https://github.com/Azure/azure-sdk-for-python/issues
(I work in the Azure SDK for Python team at MS)
Thanks to #laurent-mazuel I found the problem that Navigation Properties are missing from SDK
Workaround:
From documentation: Service Principal Entity has Navigation property appRoleAssignedTo. Then the solution was to use raw API endpoint as folows:
https://graph.windows.net/{tenant_id}/servicePrincipals/{service_principal}/appRoleAssignedTo/ and extend ServicePrincipalOperations in azure-sdk-for-python
Which returns AppRoleAssignment entities.
I want to send an order to oanda to make a transaction,I use ipython notebook to compile my code,this is my code:
import oandapy
trade_expire=datetime.now()+timedelta(days=1)
trade_expire=trade_expire.isoformat("T")+"Z"
oanda=oandapy.API(environment='practice',access_token='XXXX....')
account_id=xxxxxxx
response=oanda.create_order(account_id,instrument='USD_EUR',units=1000,side='buy',/
type='limit',price=1.105,expire=trade_expire)
But the error is:
OandaError: OANDA API returned error code 4 (The access token provided does
not allow this request to be made)
How can I solve this problem?
I had the same problem, but when sending orders via curl commands.
The problem has to do with which API you are using from which account.
I notice in your python it says "practice," so you'll want to make sure the API token you generated is from within your practice account. Live accounts and practice accounts each use their own API tokens, and your commands will need to match.
You might also look elsewhere in your python, where it actually pings OandA's server.
For example, when using curl, a live account uses
"https://api-fxtrade.oanda.com/v3/accounts/<ACCOUNT>/orders"
and a practice account uses
"https://api-fxpractice.oanda.com/v3/accounts/<ACCOUNT>/orders"
Using your API token generated on your live account in a practice account will produce the error you're asking about.
I've been trying to use Etherpad lite/beta API via PyEtherpadLite.
My question is that where do I find my API Key ? As per the documentations, the api key is stored in a .txt file in the base dir of the client folder. But my actual question is that i just want to access this pad via API which is hosted by someone. So now where will i find the api key?
In another blog, I found that the Api key for https://beta.etherpad.org/ is EtherpadFTW.
But that doesn't seems to be working. I'm getting no or wrong API Key response.
Don't use the beta.etherpad.org API, it's not for public consumption.
The API key is in your Etherpad Server home folder as APIKEY.txt
You can't use the API of another instance unless they give you the API Key.
I maintain the beta.etherpad.org site, I don't see the value in exposing the API Key publicly.
Is there a way to use Simple Access API (Developer Key) instead of oAuth2 key with Google Cloud Endpoint?
Extra fields in your protorpc request object that aren't part of the definition are still stored with the request.
If you wanted to use a key field as a query parameter, you could access it via
request.get_unrecognized_field_info('key')
even if key is not a field in your message definition.
This is done in users_id_token.py (the Auth part of the endpoints library) to allow sending bearer_token or access_token as query parameters instead of as header values.
Unfortunately, the nice quota checking and other associated pieces that a "Simple API Access" key gives are not readily available. However, you could issue your own keys and manually check a key against your list and potentially check against quotas that you have defined.
For those looking to use #bossylobster's answer in Java, use the the SO Answer here:
Getting raw HTTP Data (Headers, Cookies, etc) in Google Cloud Endpoints
P.S.
I tried to make this a comment in #bossylobster's answer, but I don't have the reputation to do that. Feel free to clean up this answer so that other's can follow the path