Google Books API Authors [closed] - python

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I'm using the Google Books API and I want the api to send me back book info about a specific author (like list some of their books). However my link currently doesn't seem to be doing that as whenever I use the inauthor parameter, all the books it sends me aren't written by the author.
For example:
'https://www.googleapis.com/books/v1/volumes?q=inauthor: emilyhenry & printType=books&langRestrict=en&key=mykey'
none of the books returned with this link are written by emily henry.

you need to factor in the space(so first name plus last name) in author's name. so it will be emily+henry
so api call will be:
https://www.googleapis.com/books/v1/volumes?q=inauthor:emily+henry&printType=books&langRestrict=en&key=mykey

When running the same request with the given url, I am also getting back books not written by the given author. However, if I remove the spaces in the url that shouldn't be there, I get back 0 books. I think your search of "emilyhenry" isn't yielding results.

Related

Is there any way to search tweet by url? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 11 months ago.
Improve this question
https://twitter.com/metakongz_G/status/1502223321009913857?t=PVLQS03E87nARHxbOMBjDQ&s=19
I have this target url. I want to get this tweet's retweets and comments using tweepy.
However it seems to be like tweepy does not support searching with url. How can I?
There are several ways:
Try to use automated browsers: There is an interesting manual that can help with Selenium and Python
Use official or unofficial Twitter APIs, example from RapidAPI
Get tweet id from url (numbers between "/status/" and "?") and use tweepy by id like here:
url = "https://twitter.com/metakongz_G/status/1502223321009913857?t=PVLQS03E87nARHxbOMBjDQ&s=19"
id = url.split("/status/")[1].split("?")[0]
print(id)

How to check if something new appears on a certain web page in Python? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I am scraping a web page using BS4 & Scrapy. Is there a way to check if something new appears? If so, can it be copied and printed out?
For example, here is a soccer match that is live as I'm writing this post. Each scored goal is indicated by the player's name, it's time, and the soccer ball, which is span with the class icon soccer-ball. How can I check the page, let's say, every 2 minutes, and print out if someone scores a goal?
HTTP has header Last-Modified.
A big part of Chapter 11. HTTP Web Services
in "Dive into Python" is dedicated to "how not to fetch data"
Scrapy: Look at documentation of Downloader Middleware

REST API vs non-REST API [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I read about REST API specifications. These are the principles:
everything is a resource
each resource is identifiable by a unique identifier
use the standard HTTP methods
Now suppose there is a table for contact details
id , owner, contact name,contact number, created At
I want to design an API to consume the data. I can design the api in the following ways.
For getting the contact by owner
Get /contact/owner/david
or
Get /getContactByOwner?ownerName="david"
For writing into the table
post /contact/owner
{contactDetail JSON in request param}
or
post /addToContact?owner="john"&...
Which design is RESTful? What is wrong with the other one?
The rule of thumb with RESTful naming conventions is to use nouns as your endpoints (since your verbs should be limited to get / post / put / delete / etc). So in your example, Get contact/owner/david and Post contact/owner would be preferable. However, if you're really using REST architecture, you should technically be using HATEOAS (Hypertext-as-the-engine-of-application-state) and including links in XML or HTML responses, so if you're using JSON it's probably more REST-like as opposed to full-blown REST. At the end of the day, it's all a matter of preference; just try to use whatever will fit the needs of the application's users in a way that's somewhat self-documenting and intuitive.

Discussion comments from Coursera [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I would like to do a simple machine learning project where I want to analyse comments from discussion forums on Coursera courses.
However, I am not sure if it is possible to do so programatically. So, providing a course page address, user name, password and getting all the discussion forums comments.
Being able to use Python for this would be awesome but I am language agnostic.
You can access web pages with python using urllib:
https://docs.python.org/2/library/urllib.html
or the higher lever interface requests:
http://requests.readthedocs.org/en/latest/
Then you still have to parse the content of the page and extract the comments.

how should I create good rest api? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
to get posts for a user:
GET http://test.com/users/123/posts or GET http://test.com/posts?user_id=123
to get new posts count:
GET http://test.com/posts/count/new or http://test.com/new_posts_count or others?
This is a good read: http://www.vinaysahni.com/best-practices-for-a-pragmatic-restful-api.
And in terms of the two formats you suggested: I prefer the former.
Doesn't matter from a REST point of view (REST doesn't define URI structure). The client should not know the URL structure before hand so technically it doesn't matter to the client either.
I personally prefer the first style as I think it makes more sense when you have a resource hierarchy. It also allows a client to move back up a URI by simply chopping off the end resource, similar to how you can go back up a directory on a file system by simply clicking the parent button.
But there is no "right answer" to this from a REST point of view. REST is concerned with the transfer of state of resources, not the resource hierarchy or URI definition.

Categories