I'm very new to python so I probably have made a coding fault, but what im trying to do is use GET to retrieve data from a website. My code is as following:
import requests
r = requests
r.GET = 'http://example.com/hi/there?hand=wave'
print(r)
Pycharm returns the following in the console:
C:\Users\Me\PycharmProjects\PhoneNumberRequest\venv\Scripts\python.exe C:/Users/Me/PycharmProjects/PhoneNumberRequest/venv/Scripts/ApiRequest.py
<module 'requests' from 'C:\\Users\\Me\\PycharmProjects\\PhoneNumberRequest\\venv\\lib\\site-packages\\requests\\__init__.py'>
Process finished with exit code 0
Isn't it supposed to give back the data that comes with the API? What am i doing wrong?
I reckon you should rather write
result *(or whatever)* = r.GET('http://example.com/hi/there?hand=wave')
since you don't want to set the value of r.GET(...) but of a new variable that contains the result/response.