Do I need google API key to download some names from freebase? - python

I want to collect some names like: location names, organization names, etc. from freebase. I do some research and find some python scripts. But it looks like I need to register a google API key something ? Is it the must and if yes do you know how could I get that?
Is there any example that they do similar thing ? Many thanks!

you can download the entire freebase
you need a key to use the api. the documentation for the api of free base can found in:
https://developers.google.com/freebase/v1/getting-started#api-keys
and
to obtain a key: https://code.google.com/apis/console/

Related

delete a data feed from google recommendations AI

My company is trying out google's recommendation AI using BQ exports of merchant center and GA data sources. However, we discovered a configuration error in the merchant feed which led to most of the events being unjoined.
I would like to do a new (clean) setup and am looking for the best way to delete the old data. It seems only possible via the API?
Secondly, while the UserEventService has a purge function, there doesn't seem to be a similar function for the ProductService.
Is deleting each product one by one the only way to go?
Any pointers and examples (Python) would be greatly appreciated as there seems to be very little documentation about this at this point in time.
As you mentioned, the only way to delete data is through the API, you can use Google Cloud Client Libraries or use REST requests; however, the library does not have a function to purge all the Product data.
In this case will be necessary to delete one product at a time by using the delete_prod() function (example).
Nevertheless, as a workaround you can get the id product get_product()function (example) of your products and add them into a collection, then, iterate this collection and pass each value into the delete_prod(). In that way you can delete all the data products, but this needs to be reviewed on your side.
Additionally, I would like to share additional information provided by Google where you can find all related to Python Library.
Retail Docs API,
Python Retail library, GitHub Repository Retail API
Please keep in mind that Stackoverflow is for specific questions about code such as errors.

Google drive API : How to find all files I shared with others

I am using drive api v3 to look for files I hare shared with others (anyone),to list them & potentially cancel sharing them.
I know that in the search box you can do a 'to:' and it will retrieve these files, but I could not use such thing on the API.
my current tri ;
query="'me' in owners and trashed=false and not mimeType = 'application/vnd.google-apps.folder' and visibility != 'limited'"
Thanks in advance
As tanaike said, a workaround that solves the problem is by looping through the files using files.list() function, and including id, owners, permissions in the fields. This is going to return a list of objects, and from there we can check if type is anyone.
From there, we can also check for attributes like shared:true & ownedByMe:true.
This is just a workaround, and surely not the best solution, since with Drive search, we can do all this by typing to:, which lists all owr shared files. I hope we get an API for this.
Thanks again tanaike

How can I use a google classroom API on a website I am making to access specific rosters and put them on a list displayed on the website?

I am making a website for a teacher and he wants to be able to take attendance easily and he wants me to use the google classroom api to access his roster in his class so that it can then display that list of names on the website and he can easily take attendance there
Roster importing is a common use case we see with the Classroom API. Here's what the workflow typically looks like:
On your website, the teacher chooses the option to import a Classroom Course.
On your backend, call the courses.list method through the Classroom API, which will return a json response.
From this json response, list the titles of the teacher's courses for them to select 1. Note: you'll need to keep track of the course IDs to continue onto the next step.
With the course ID, call the students.list method and display all names on your website for teachers to take attendance.
On each of the links above, you can use the API Explorer to see exactly how these methods behave. I also recommend you check the documentation for managing courses and students/teachers -- there are code snippets for a few different languages, including Python.
Hope this helps!
The best thing to start with is to navigate in the official documentation for Classroom API.
The Classroom API provides a RESTful interface for you to manage
courses and rosters in Google Classroom.
For python, you can refer to the quickstart guide designed for Python implementation. See sample code.
To access students, use REST Resource: courses.students.
You will be able to use the supported methods such as create, delete, get and list.

Python code to connect to twitter search API

I'm new to Python and am very confused on how to begin this assignment:
Write Python code to connect to Twitter search API at:
https://api.twitter.com/1.1/search/tweets.json
with at least the following parameters:
q for a search topic of your interest;
count to 100 for 100 records
to retrieve twitter data and assign the data to a variable.
I already created the app to access Twitter's API. Thanks.
I had this same issue. According to Twitter, you must register an account to even use basic search features of public tweets and there is no way around it. I followed the guide for the complete setup here and can confirm it works
Edit: the article is for php, but changing it to python shouldn’t be very difficult. It has all the methods outlined in the article
Just as a hint, you might want to use tweepy for this. They have very good documentation and its much easier than trying to reinvent the wheel.

Using Flickr API to get images information

I want to give a keyword as input and find information of images in terms of likes, favourites, comments, description etc.
Version 3 is out here.
I have read of functions which provide information corresponding to a user_id or photo_id. But, what about keywords ?
Is there anything like that ?
Take a look at flickr's search and photos.getInfo APIs.

Categories