title: How to authorize via token in Python to an API
body: <p>I´m completly new in Python-programming and I´m trying to get access to a e – scooter rental service and crawl the data oft he scooters. The service provider is Bird and has no official API and is only accessible via an app for Android or iOS. Someone found a way and the requirements for the posts and gets are here documented: <a href="https://github.com/ubahnverleih/WoBike/blob/master/Bird.md" rel="nofollow noreferrer">https://github.com/ubahnverleih/WoBike/blob/master/Bird.md</a></p>
  
  <p>My problem is after i authorized myself by the token I can´t create a get-request. The Server says all the time: 
  {"code":401,"message":"Credentials are required to access this resource"}</p>
  
  <p>This is my code:</p>
  
  <pre><code>import requests
  import json
  import uuid
  target = "https://api-auth.prod.birdapp.com/api/v1/auth/email"
  headers = { "User-Agent": "Bird/4.53.0 (co.bird.Ride; build:24; iOS 12.4.1) Alamofire/4.53.0"
             ,"Platform": "ios",
             "App-Version": "4.53.0",
             "Content-Type": "application/json",
             "Device-Id": str(uuid.uuid4())}
  data = {"email": "any@mail.com"}
  reply = requests.post(target, data=json.dumps(data), headers=headers)
  
  # at this point u get an email and u need to copy the token in the email
  
  token = {"token":"IGzMtdAkQ3icmSFV0V64yQ"}
  url_token = 'https://api-auth.prod.birdapp.com/api/v1/auth/magic-link/use'
  
  # now you are authorized and you can start get-requests
  
  get_headers = {"Authorization" : "IGzMtdAkQ3icmSFV0V64yQ",
                "Device-id" : str(uuid.uuid4()),
                "App-Version" : "4.41.0",
                "Location" : json.dumps({"latitude":37.77249,"longitude":-122.40910,"altitude":500,"accuracy":100,"speed":-1,"heading":-1})}
  url_get_birds = "https://api.birdapp.com/bird/nearby?latitude=37.77184&amp;longitude=-122.40910&amp;radius=1000"
  print((requests.get(url_get_birds, headers = get_headers)).text)
  </code></pre>
  
  <p>The last print command  gives me the 401 error all the time</p>
  
  <p>I guess i don´t use the token in get_headers as an authorization correct…
  Sorry to bother you but I really don´t know how to progress.</p>
  
  <p>Thank you very much</p>