403 Forbidden or access denied for some website why? - python-2.7

when scraping from website using bs4 it showing response object as access denied and Forbidden how to solve this?

Make sure that you have added the required headers such as 'User-Agent' before firing the get Request. In most cases, if 'User-Agent' is not provided, you'll end up with 403 response.

Related

Django allauth Access blocked: This app’s request is invalid

I'm using django allauth. Everything working fine, except when trying to signup using Google. I got this error: Access blocked: This app’s request is invalid.
Is there any solution to this?
Here is my Google Developer Console:
I've also tried to change http to https and it's also not working
You url is not matching with google url please correct your url in Clound console.
So in my case, what I have to do is change the Authorized redirect URLs from:
http://localhost:8000/accounts/google/login/callback/
http://127.0.0.1:8000/accounts/google/login/callback/
to
http://localhost:8000/google/login/callback/
http://127.0.0.1:8000/google/login/callback/
just remove the "accounts/" and it works fine.

Getting 403 error when trying to add new tenant

I added a service provider to WSO2IS and use its secret to get an access token, I then use this access token to execute endpoint https://localhost:9443/t/carbon.super/api/server/v1/tenants, but I am getting 403 error. An access token is for the admin user, that as far as I see has all privileges. Why am I getting a forbidden error and how can I fix it?
Follow the steps in https://stackoverflow.com/a/65371473/10055162. If you generated the token without passing the required scopes (In your case internal_list_tenants), you will get 403 Forbidden response from the REST API call. More info (3)

Postman 401 Unauthorized using Ocelot

I am implementing an Ocelot gateway. When I make the API call using my browser to http://localhost:5009/api/values, I get a valid json response back. However when I make the same request through Postman I get a 401 Unauthorized response. Any ideas if there is a setting in Postman I need to change or something else.
That is, the client must authenticate itself to get the requested response.
Most likely you have forgotten to put your token to the Header in Postman to be authenticated for the server in order to get a response.

Whats wrong with this graph api

https://graph.facebook.com/me/feed?access_token=dsjsdchsdch&message=test
I used it with the real access token. Its throwing 403.
and oh, i did POST it.
See if the content of the HTTP 403 has an actual API error associated with it.

What status code should I use when session token is invalid?

When creating a web service (RESTful), what status code should I use when session token is invalid?
Currently the one in my company sends me a 404, not found, but I think this is not correct, because the resource exists.
Maybe I should use 401 Unauthorized.
What do you think? What status code do you recommend me to use in this scenario? Thanks.
401 Unauthorized.
Your existing session token doesn't authorize you any more, so you are unauthorized.
Don't forget that a session token is just a short-cut to avoid having to provide credentials for every request.
Sending 404 is incorrect because, as you observe, the resource does exist. You just don't currently have authorization to see it.
NB Don't use 403 Forbidden; the HTTP specification defines it as follows: "The server understood the request, but is refusing to fulfill it. Authorization will not help and the request SHOULD NOT be repeated." That doesn't apply in this case as authorization WILL help.
Looking through the HttpStatusCode enum, I think Unauthorized is probably the closest to what you're looking for.
Take a look at the list there, and read the descriptions for each one.