I'm trying to debug a "too many queries" error I'm getting in my rails app. It appears that the rate limit is being surpassed. I'm trying to locate where the app is providing a Google Geocoding service API key but I don't see it anywhere. I understand that you can optionally create a geokit config file in config/initializers/geokit_config.rb and provide an API key there. However, this project has no such geokit config file.
Does the geokit library use a default Google Geocoding service API key that is hardcoded in the library if there is no geokit_config.rb file present in the app? Stated another way, is it completely optional to provide a Google geocoding API key to use the geokit library with its included google geocoding service functionality?
Thanks for any help.
I'm the maintainer of geokit. Yes, you can use it without a key, though I personally feel it would be unwise to do so in production.
But it is nice for "trying" the gem, though you'll hit your limit very quickly (you might even get that error straight away depending on how google limit, e.g. by IP)
See the README to easily set this:
# See https://developers.google.com/maps/documentation/geocoding/#api_key
Geokit::Geocoders::GoogleGeocoder.api_key = ''
Related
So i have a project where i use 'google/apis/analytics_v3' to make some requests and get some data, the thing is that i need a view_id to do that.
#service.get_ga_data(VIEW_ID, #start_date, #end_date, 'ga:users').totals_for_all_results
the thing is that, on the new version of the analytics we don't have the view_id and i cannot find a way in ruby to do the same that this does.
Someone knows how to migrate to GA4 in ruby on rails, i can't find much documentation. We are talking about server side requests to google.
Thanks in advance to someone who can help me
I went over the GA4 configs trying to find the view_id, i've seen that this will be deprecated.
I've tried find other gems to make the requests and the authentication
Went to the github of the gem to check for updates.
Couldn't find a way
The 'google/apis/analytics_v3' library is for use with Universal analytics and requires a view id.
You need to use the Google analytics data api to access google analytics ga4 accounts.
require "google/analytics/data"
Google::Analytics::Data.configure do |config|
config.credentials = "path/to/keyfile.json"
end
client = Google::Analytics::Data.analytics_data
I was following this tutorial, https://towardsdatascience.com/how-to-download-twitter-friends-or-followers-for-free-b9d5ac23812, which was written in 2021. It should've worked fine, however, they have to 'fix' the things that just work.
Specifically, running this line
for fid in Cursor(api.followers_ids, screen_name=screen_name, count=5000).items():
ids.append(fid)
gives the error:
"tweepy.error.TweepError: [{'message': 'You currently have Essential access which includes access to Twitter API v2 endpoints only. If you need access to this endpoint, you’ll need to apply for Elevated access via the Developer Portal. You can learn more here: https://developer.twitter.com/en/docs/twitter-api/getting-started/about-twitter-api#v2-access-leve', 'code': 453}]"
I could have pulled the data in five minutes. Now debugging this already cost one hour+ because they just break the things that work. Is there anyway to make this old code snippet work? The application to use API 1.1 takes weeks, and I don't have time to watch their bad documents of how to migrate from API 1.1 to 2.0 and then the documents of migrating from Tweepy 3.9.0 to 4.0.0. Five minutes' task would just become half a day. Thanks in advance for any help.
First of all, have you at least tried to apply for the Elevated access?
It can take some time, it's true, but it can also be instantaneous.
The other solution would be to use the Twitter API V2.
You don't need any tutorial, just read the documentation:
Here for the authentication ;
Here for the retrieval of the followers ;
Here for the pagination.
And you should get something like that:
import tweepy
client = tweepy.Client("Bearer Token here")
paginator = tweepy.Paginator(
client.get_users_followers,
id=..., # ID only, no screename
max_results=1000
).flatten()
for follower in paginator:
print(follower.id)
Finally, even if I understand your frustration (and developing Twitter applications can be very frustrating), I think that you should try to keep it out your SO questions. Good luck!
I just got an API key for a database I wish to access and want to start building my Rails app. However I dont know where to begin with the API key. Specifically I want to use the brewerydb data and I am building an app where users can find the closest brewery to their location. Can anyone tell me how to get started? I am new to Rails and have never used an API before. I don't know where to begin. What file should I put it in, etc... I know I should probably update the GEMFILE, where else?
Thanks!
Check the documentation for the API. That's all I can say. (well... not really: )
Most API's rely on REST or SOAP, which is basically making HTTP request to certain URI's. An example may be
http://api.somewebsite.com/beers.json
Which would return, for instance, a JSON array of certain beers and their properties.
Furthermore, more often than not, you can test API's (that do not require certain HTTP headers for authentication, which makes it harder) by manually constructing the URI's and opening them in your browser. This way, you can verify that your request is okay before you try it in your Rails application an cannot figure out why it's not working.
You should use the 'figaro' gem https://github.com/laserlemon/figaro
It creates a "application.yml" file in which you can add your API key.
I'm not sure why I'm getting REQUEST_DENIED error when I'm using iOS key. When I used the one for web application, it works fine, but it's only for testing since I must test from specific IP address.
I followed the instruction on this page, Obtaining an API key, but I still can't get it work. Do you know if there is something else I have to do? I made sure the bundle name is correct already.
So it seems like as of 09/09/13, there is no support for Places API for iOS. You have to use the one for web with any referrer rather than specify any static IP. Hope this help saves someone sometime. It took me quite a few hours to find this out.
I am just looking for the best solution for the following problem.
I have installed wordpress mu, and I wanted to create child blogs, for different areas in the world. But I want it so 1 domain can switch them instantly using the users ip address.
IS there a extention of wordpressmu or buddypress or do I need something on the server say in htaccess to do that?
Check this plugin out: http://wordpress.org/extend/plugins/ip-to-country/
You could possibly use this, check the value returned, and set a WordPress cookie for the user that automatically redirects them to the geo-specific blog and will do so if/when they return to the site.
Check out the Google API for geocoding, user detection, and geogrouping options (redirect all users from combined location like 'Europe'). Rather then doing all the heavy lifting on your server, work with the Google API, get your nicely formatted answer back, and redirect based on that....
Anything that involves geographical relation .... GOOGLE GOOGLE GOOLE