I'm trying to use requests
and bs4
to get info from a website, but am receiving the status code 304 and no content from request.get()
. I've done some reading and understand that this code indicates the resource is already in my cache. How can I either access the resource from my cache, or preferably, clear my cache so that I can receive the resource new?
I've tried adding the following header: headers={'Cache-Control': 'no-cache'}
to requests.get()
but still have the same issue.
Additionally I've looked into the requests-cache
module, but am unclear on how or if this could be used to solve the problem.
code:
import requests
r = requests.get('https://smsreceivefree.com/')
print(r.status_code)
print(r.content)
output:
304
b''