title: Python 3 with Requests trying to use Tumblr API, I get error 401?
body: <p>I have Python 3 and I am trying to post to Tumblr via API <a href="https://www.tumblr.com/docs/en/api/v2" rel="nofollow">link to API documentation</a>. I keep getting an error 401 despite feeling like I am doing everything correctly. There is an official API client in Python 2 but that feels a bit hard to follow and all other mentions of it seem to be in PHP or Java. I also am not sure of the format to post in after the 401 error because the documentation doesn't give any explicit examples other than /post. My code:</p>
  
  <pre><code>import requests
  from requests_oauthlib import OAuth1
  #variables for later
  client_key=""
  client_secret=""
  oauth_token=""
  oauth_token_secret=""
  
  #gets the values for the variables
  with open("API.txt", 'r') as readAPI:
      readAPI.readline()
      client_key=readAPI.readline()[23:]
      client_secret=readAPI.readline()[23:]
      oauth_token=readAPI.readline()[23:]
      oauth_token_secret=readAPI.readline()[23:]
  readAPI.close()
  
  #prints them to double check they are being read correctly
  print(client_key)
  print(client_secret)
  print(oauth_token)
  print(oauth_token_secret)
  
  #sets oauth for the connection
  oauth = OAuth1(client_key,
                 client_secret,
                 oauth_token,
                 oauth_token_secret)
  
  #check post that should return various blog stats
  r = requests.get("http://api.tumblr.com/v2/user/info" ,auth=oauth)
  
  print(r)
  </code></pre>
  
  <p>I am 100% sure I am getting the client key, the client secret, oauth token and oauth token secret correct. I have double checked, the oauth tokens are both put in the file that is being read manually and they are printed before the connection attempt. I am 100% sure it is correct. I'm wondering if Tumblr's API is broken?</p>
  
  <p>Edit: This is with print(repr())</p>
  
  <pre><code>'client_key'
  'client_secret'
  'oauth_token'
  'oauth_token_secret'
  {"meta":{"status":401,"msg":"Not Authorized"},"response":[]}
  </code></pre>
  
  <p>This is what happens after trying a new code and with Steven's method with JSON.</p>
  
  <pre><code>b'{"meta":{"status":401,"msg":"Not Authorized"},"response":[]}'
  </code></pre>