Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid Error 403 #1

Open
EmilioPlumed opened this issue Jun 4, 2023 · 1 comment
Open

Avoid Error 403 #1

EmilioPlumed opened this issue Jun 4, 2023 · 1 comment

Comments

@EmilioPlumed
Copy link

Trying to use the script as is, I got error 403. After a quick online search, it seems that requests are denied by the servers if they believe the script is not a real user. This page offers different solutions, https://scrapeops.io/web-scraping-playbook/403-forbidden-error-web-scraping/#:~:text=The%20most%20common%20reason%20for,%2C%20NodeJs%20Axios%2C%20etc.) , and the simplest one seemed to do the trick for me:
clear_screen()
HEADERS = {'User-Agent': 'Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148'}
response = requests.get(f'{base_url}/{image_id}.json',headers=HEADERS)

@shirooo39
Copy link
Owner

... it worked for me when I wrote the script?
anyway, I haven't been using the script anymore since Google Colab banned the use of Stable Diffusion WebUI on their free tier, but I'll learn more about your suggestion, so thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants