Axios.get is showing Network Error when made get request

Viewed 36

I am building a react app and I am trying to make get request using axios, I am trying to access imdb page like :-

https://www.imdb.com/find?q=Tom%20Hanks

But when I call the axios then it is showing

AxiosError {message: 'Network Error', name: 'AxiosError', code: 'ERR_NETWORK', config: {…}, request: XMLHttpRequest, …} code: "ERR_NETWORK" config: {transitional: {…}, transformRequest: Array(1), transformResponse: Array(1), timeout: 0, adapter: ƒ, …} message: "Network Error" name: "AxiosError" request: XMLHttpRequest {data: undefined, onreadystatechange: null, readyState: 4, timeout: 0, withCredentials: false, …} response: XMLHttpRequest {data: undefined, onreadystatechange: null, readyState: 4, timeout: 0, withCredentials: false, …} [[Prototype]]: Error

But When I try to access localhost using axios then it is working fine But not working with imdb

then I tried accessing imdb with python requests then it is showing 200 SUCCESS.

I have tried many times But it is showing that error everytime.

App.js

class App extends React.Component {
    componentDidMount() {
           axios.get('https://www.imdb.com/find?q=Tom%20Hanks').then(res => {
             console.log(res)
          }).catch(err => {console.log(err)})
    }

    render() {
      return(<div>Good Luck</div>)
   }
}

Any help would be much Appreciated.

0 Answers
Related