0

I'm new to Python and API's. I'm trying to work on a project and need some help.

I just want to request some information from Blogger to get back blog post details (title, body, etc) and return it.

I'm wanting to use these: https://developers.google.com/resources/api-libraries/documentation/blogger/v3/python/latest/blogger_v3.blogs.html

I can use requests.get(url/key) and I get a server status[200], but everytime I try to find a way to use one of the requests from the link I get keyword errors.

For example: "TypeError: request() got an unexpected keyword argument 'blogId'"

My code is requests.get('url/key' blogId='BLOG ID HERE', x__xgafv=None, maxPosts=None, view=None)

I don't feel comfortable posting my exact code, since it has my API in it.

What am I doing wrong?

  • The errors says that, requests.get isn't expecting the keyword param "blogId"; You have to pass the extra details in data header? I would recommend reading on the requests module docs, they are pretty nicely written! – Aditya Jun 25 '20 at 05:14

3 Answers3

0

request.get() method doesn't have blogID parameter. For more info use this link

0

I am not sure, but oyu can use params like that:

page = get('https://google.com', params={'blogId': '12345'})

It's better to look up information in the docs: https://requests.readthedocs.io/en/master/

Andrey
  • 146
  • 1
  • 2
  • 8
0

I found my solution after digging a bit.

I was using get requests on the API to get a response, which is how it should be used.

Yet, I was also trying to use a method of returning data that also used the get keyword, but was meant for use with the Google API Library.

I had to install the Google API Client library and import build, and requests so that I could use the API methods instead. This allows me to return results that are far more specific (hence the keyword arguments), and can be programmed to do a number of things.

Thanks everyone!