replacing http request with request library