简体   繁体   中英

Python Requests Module: get() takes no keyword arguments

I am rewriting this question to make it more concise and focused on the real problem:

test program code: https://drive.google.com/file/d/1kDEUxSpNMlyxPYqPw0ikUxG8INW4My8n/view?usp=sharing

implementation program code: https://drive.google.com/file/d/14v06AZlGMTFMmFeaQ9cbpmNJwI33fNtS/view?usp=sharing

Currently, I have the same code that I am trying to run in the test program and the implementation program.

r = requests.get(url, headers = head)

Located in line 58 in the test program and 381 in the implementation program. In the implementation program, that line throws this error:

r = requests.get(url, headers = head)
TypeError: get() takes no keyword arguments

This does not happen in the test program. Any suggestions would be very much appreciated. Thanks!

So, when you have bearer token with you, is client ID is really needed?

Well, here's how I do,

headers = { 'Authorization' : 'Bearer  ' + 'bd897dbb4e493881c8385f89f608d5e3bf28c656' }
r = requests.get(<url>, headers=headers, verify=False)

response = r.text

Please give a try.

problem was that I had a dictionary named requests too. Thanks for your time and help

The.get() function doesn't require you to specify which type of argument it is. Just input your url as a variable name into requests.get() like so:

import requests

url = # your url
r = requests.get(url)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM