Google OAuth2.0 but with Python

Good day everyone,

I am writing a script that automatically schedules 5 Youtube Live broadcasts with different pre-set timings every week.

I have managed to schedule one broadcast on the Youtube API Try It Out page, but I am struggling to properly authenticate my Google Account in Pipedream.

I also only know how to write Python, and I am struggling to understand the Node.js boilerplate code available. I’m only interested in writing this code for myself, so I’m open to just hardcoding any secret IDs in (although that does sound quite dangerous).

I don’t know the steps to connect to the Youtube API with OAuth2.0 within Pipedream.

I see that I can use the Youtube Data API on Pipedream. Can this give me an access token that I can use in subsequent steps to create the broadcasts? How do I get the access token and provide it in python?

I’m sorry if this question is basic, I have never worked with APIs before!

do I also need to use my client_secrets.json file? Because I can’t access it within python so I’m not sure how I will upload that

Holy smokes! I did it! In case someone is lost like me, you can export your access token in the first step using node.js and returning this.youtube_data_api.$auth.oauth_access_token.

then fetch it in your python script with:
access_token = steps[“get_access_token”]["$return_value"]

then in python when building your api client (remember to import):
creds = Credentials(access_token)
youtube = googleapiclient.discovery.build(api_service_name, api_version, credentials=creds)

1 Like

Hi @m-ods

Congrats! Happy you were able to figure it out :slight_smile: Great job discovering the multi-language support in a workflow!

You can combine Node.js steps with Python, Go or even Bash in the same workflow and wire them together with step exports.

With this pattern you’ve found, you can connect the 700+ Node.js app integrations from our registry even with Python.

We haven’t covered this feature in our university series yet, but it’s going to be a dedicated episode!