-2

I am trying to get a blog by ID from Blogger.

Here's what Blogger API docs say I should add:

get(blogId=*, x__xgafv=None, maxPosts=None, view=None)

Gets a blog by id.

Args:

  • blogId: string, A parameter (required)
  • x__xgafv: string, V1 error format.
    Allowed values
    • 1 - v1 error format
    • 2 - v2 error format
  • maxPosts: integer, A parameter
  • view: string, A parameter

I've taken out the sensitive information (like the API Key):

url = 'blogger's url and api key'
PARAMS = {blogID = '######'}

blogs = requests.get(url, PARAMS)

print(blogs)

<Response [403]>

Is this an issue with authentication, or am I screwing something up?

I can do a get request on the url + api key and it returns <Response [200]>, so I'm certain I'm communicating with the correct server. It's just that I thought the API key would be enough to get back some basic blog post information.

I've looked at https://requests.readthedocs.io/en/master/user/quickstart/#make-a-request

and I'm clueless as to what I'm missing...these are arguments, right? That link only mentions parameters, and I can't figure out the syntax I'm missing.

1 Answers1

0

I think you may be conflating blogUserInfos.get and requests.get, which are entirely different methods in entirely different modules.

I don't know anything about Blogger or the Blogger API - I've never used it or even know what it is, but the documentation indicates that you can make a simple HTTP GET request to the desired blog (by ID), and include your API key in the query string of the request URL. You would make this request using requests.get. The URL from the documentation looks like this:

https://www.googleapis.com/blogger/v3/blogs/2399953?key=YOUR-API-KEY

Where 2399953 is the blog ID, and YOUR-API-KEY is your API key. The response will be JSON, I'm guessing.

Paul M.
  • 10,481
  • 2
  • 9
  • 15
  • Okay, makes sense...what is this referring to then? https://developers.google.com/resources/api-libraries/documentation/blogger/v3/python/latest/blogger_v3.blogUserInfos.html – YoungSherlock Jun 25 '20 at 19:50