Python Requests Authentication Examples - Basic Auth, Custom Headers w/ Code

Поділитися
Вставка
  • Опубліковано 11 лип 2021
  • We'll talk about basic authentication and how to use custom headers for tokens in this video with a couple of examples. Want a specific example of the service you're using? Let me know!
    Video on getting started with requests:
    • Python Requests Librar...
    ** Want to clone this script? **
    wayscript.com/script/m1Fbl9xt
    Questions about this script or anything else? Join our discord. We're always around to help.
    / discord
    wayscript.com/
    Follow WayScript on Social Media:
    GitHub - github.com/wayscript
    Twitter - / wayscripthq
    Linkedin - / wayscript
    Instagram - / wayscript
    Facebook - / wayscript
    #WayScript gives you flexible building blocks to seamlessly integrate, automate, and host tools in the cloud. Unlock new potential with drag and drop programming.
    Need ideas on how to use WayScript? View our template library to get ideas:
    wayscript.com/community
    Ready to get started? Get Superpowers with WayScript today.
  • Наука та технологія

КОМЕНТАРІ • 52

  • @brauliocastelblanco6597
    @brauliocastelblanco6597 Рік тому

    Newbie on API world, reading documentation for 3 hours and thanks to you i finally connect , thanks!

  • @jadeolayy
    @jadeolayy 2 роки тому +1

    Thank you much, first time using REST API so wasn't really sure how to translate the API documentation to python code, this helped clear it up quick and easy, thank you for creating!

  • @roberthackett2155
    @roberthackett2155 Місяць тому

    Great video! I watched a few others that were overly complicated, but this was easy to follow and got me up and running. Thanks!

  • @adv_rdr
    @adv_rdr 2 роки тому +4

    You are an absolute BOSS for making this. Thank you for your help. Really good format. Straight to the point, no BS.

  • @samuelsantos4401
    @samuelsantos4401 Рік тому

    Thank you very much.
    I looked for several videos in my language and I couldn't find it, here it was fast and objective.
    Message from Brazil.

  • @sahmedalee
    @sahmedalee 2 роки тому +1

    Simple and to the point. Thanks a lot

  • @arthurbarbosaqueirozbisnet104
    @arthurbarbosaqueirozbisnet104 2 роки тому

    Great video. Simple and explanatory.

  • @genesebarbosa
    @genesebarbosa Рік тому

    Very very simple explanation and helpful !! Thx Bro!!

  • @KhalilYasser
    @KhalilYasser 2 роки тому

    Thank you very much. Awesome tutorial.

  • @AustinCrider
    @AustinCrider Рік тому

    Thank you so much for this video!

  • @nikoghos
    @nikoghos Рік тому

    Thank you. Helped a lot!!

  • @imogenthorburn1952
    @imogenthorburn1952 2 роки тому

    this helped me out so much thanks

  • @Are_U_Kidding
    @Are_U_Kidding 13 днів тому

    Great work ❤

  • @MarceloLopesdeAmorimJunior
    @MarceloLopesdeAmorimJunior Рік тому

    Simple and precise. Way to go! Awesome

  • @zoemercuryastrology7931
    @zoemercuryastrology7931 2 роки тому +1

    Thank youuuu!

  • @ezezez6150
    @ezezez6150 Рік тому

    Thx bro , you saved my ass today.God bless you!

  • @gareemadhingra
    @gareemadhingra 2 роки тому +1

    Short and crisp

  • @user-uv9vq5ey1f
    @user-uv9vq5ey1f 2 роки тому

    I'm doing a bot traffic,and in authentication (log-in) i get a 429 error....I try to put some delays but nothing happent..Do you have any idea?

  • @user-vd7op7mk2y
    @user-vd7op7mk2y Рік тому

    i need to automate api more than one user in that case i can't use in payload username and password, what should i do,

  • @romanpryshlyak252
    @romanpryshlyak252 Рік тому

    Thank you!!!

  • @prasadsawant7399
    @prasadsawant7399 Рік тому

    well explained. Could you in next video add how to cache the token so that it can be reused in subsequent calls? Mainly for performance reasons.

  • @ibrames3
    @ibrames3 Рік тому

    Hey dude! How can I make login in a website that needs a verification code? I have it all: urls, user, pass and gmail credentials (because verification code is sent to gmail) I just need to put that code on the verification URL.

  • @girish6064
    @girish6064 2 місяці тому

    Thank you

  • @nandoalpha
    @nandoalpha 2 роки тому +3

    Man, você me ajudou muito em um case no meu trabalho.
    Muito obrigado!!!

  • @osiris5449
    @osiris5449 2 роки тому

    thanks!

  • @TheNkina
    @TheNkina Рік тому

    this is very helpful, I just want to ask have to dealt with any type of authentication where there are token's involved as well as decoding those tokens?

    • @WayScript
      @WayScript  Рік тому

      Hey! normally anytime there's tokens involved you can include them with the payload you send in your POST request. Decoding just depends on how the token is encoded. Python has some built in tools to help with these sorts of things such as codecs docs.python.org/3/library/codecs.html

  • @Vinod-SR
    @Vinod-SR Рік тому

    Neat!

  • @n-4446
    @n-4446 Рік тому +2

    if the token should not share it with any one how can I involve it the code ? what I'm trying to say is should I put the token in different file rather than type it in the code ? and if it's yes how can I secure that file ?

    • @WayScript
      @WayScript  Рік тому

      There's a bunch of ways to tackle this problem. A couple common solutions would be to have the token stored as a secret within the environment that the code is executing in, and use some python like os.environ.get('token') to get that secret key.
      Another way is to encrypt keys and store them somewhere accessible and call them from your script

    • @robthethrone
      @robthethrone Місяць тому

      i know it’s been a while since your comment, but for others who are wondering:
      the common methodology is to “hide” the token in a .env file, and obtain it by importing the variable from .env file

  • @MrArrjohns
    @MrArrjohns Рік тому

    My services is requesting a call back URL before they issue an API key. Where can I gat that from?

    • @WayScript
      @WayScript  Рік тому

      Callback urls are usually from an application you own or can write code for. So for instance an online service might use a callback url to communicate with a flask application you built to send you information (that you can do something with). You can use WayScript or any other online hosting service to create urls via something like a flask app or node server

  • @paulleon3343
    @paulleon3343 Рік тому

    How can you pass multiple headers that have a curl -X GET command

    • @WayScript
      @WayScript  Рік тому

      To pass multiple headers, you can include multiple values in the headers json with a comma after each value you want to send. Example:
      headers = {'header-key-1':'header-value-1' , 'header-key-2':'header-value-2'}
      You can add as many as you want, just include a comma after each. Hope that helps!

  • @ishapaul9368
    @ishapaul9368 Рік тому

    How do I add session id to header for graphql api?

    • @WayScript
      @WayScript  Рік тому

      Apologies for the late response, we were on break here at wayscript. To add multiple headers, you can include them like:
      headers = {'header1':'value1', 'header2':'value2'}
      You can add as many as you want by separating with a comma

  • @chidanshbhatt2244
    @chidanshbhatt2244 2 роки тому

    Where did you get token value?

    • @WayScript
      @WayScript  2 роки тому +1

      The token value is what you get from whatever service you're using. In this example it came from Atlassian's site > settings > Account API Token. Each service you use will likely put that token in a different place under your account settings. If you get stuck trying to find it, the site's docs will probably tell you where to find it ( if their docs are any good haha ) - Derrick

  • @martimgradicmarreiros3210
    @martimgradicmarreiros3210 3 роки тому

    Hi wayscript, nice vid. Also wanted to say, why tf ain't y'all making a part 3 of making a ps5 bot. Part 1 and 2 are pretty much useless cause she didn't explain how to get notifications. It's one of the only good tutorials on youtube on how to make this bot. Hope to see a reaction.

    • @WayScript
      @WayScript  3 роки тому

      Yeah her tutorials were great and part #3 has been highly requested! Unfortunately a bit out of my control. I'll put together a notification video that'll be a bit more broad than 'ps5 bot part 3' but should have all the ideas of what part 3 might of ( or might will be ). I'll make sure it integrates into that specific bot too. -Derrick

    • @martimgradicmarreiros3210
      @martimgradicmarreiros3210 3 роки тому

      @@WayScript Thanks a lot for your reply (: really appreciate it.

  • @ButerWarrior44
    @ButerWarrior44 2 роки тому

    get? Why not post?

  • @rodhash
    @rodhash 2 місяці тому

    I don't sub to any channel out there specially the ones that just make us waste time, hate those that don't provide any value and begs for like.. I really like to curate my feed with good stuff in order to have nice information videos on my feed and bro your channel definitely is part of my feed now .. Amazing work, congrats .. hate that I'm finding yours just now

  • @emure5385
    @emure5385 2 роки тому

    PS5 Restock Part 3 please.

  • @strashnayazhenshina2180
    @strashnayazhenshina2180 Рік тому

    The guy looks like Milla Jovovich's son!

  • @blessedday6808
    @blessedday6808 2 роки тому

    Thank you