Python api help

my body is in JSON Format
its all working EXEPT ! it wont show the youtube video in the room it keeps showing the bunny or the lama video

PLEASE HELP !!!

@commands.command(name=‘create’)

async def create(self, ctx, args):

    url = 'https://w2g.tv/rooms/create.json'

    wkey = '[...]'

    bg = '#FF0000'

    opacity = 50

   

    headers = {

        'Accept': 'application/json',

        'Content-Type': 'application/json'

    }

    data= {

        'w2g_api_key' : '3ovwq9n0erywpheppfr7ylutwtdm698p2e5nx1fso9kc2ztew948y02c6t2zu2dn',

        'bg_color' : 'hfhjfh',

        'share' : "https://www.youtube.com/watch?v=HJvWo8xtwjE" ,

        'bg_opacity' : 'dsdsds'

    }

    data['w2g_api_key'] = wkey

    data['bg_color'] = bg

    data['share'] = args

    data['bg_opacity'] = opacity

    data = requests.post( url , headers , data).json()

    streamkey = data['streamkey']

    keyem = discord.Embed(

        title = 'Here is your stream link!',

        color = 16776960,

        url = 'https://w2g.tv/rooms/' + streamkey

    )

    #keyem.add_field(

        #name = 'Or if you just want the strem key!',

        #value = streamkey

    # )

    print(url)

    print(headers)

    print(data)

    await ctx.send(embed=keyem)

i am working with python please help

Thank for you question. Do i understand correctly that you can successfully set the background color?

Try using data = requests.post(url=url , headers=headers , params=data).json() instead of data = requests.post( url , headers , data).json() because requests.post() puts your data in the json slot instead of params slot by default.

1 Like