Unable to request URL due to connection error





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







1















I tried the following code but get a connection exception. The same connection I can successfully establish using php. Any reason why my python code is throwing an error:



def getUrl(self):
link = 'http://localhost:80/aztecgamesstudio'
data = requests.request("GET", link)
url = data.url
print(url)

Traceback (most recent call last):
File "C:Python37libsite-packagesrequestsadapters.py", line 449, in send
timeout=timeout
File "C:Python37libsite-packagesurllib3connectionpool.py", line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File "C:Python37libsite-packagesurllib3utilretry.py", line 398, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=223): Max retries exceeded with url: /aztecgamesstudio/ (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000001FA877A9EB8>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:devxampphtdocsaztecgamesstudioapplibrariesCore.py", line 27, in <module>
init = Core()
File "c:devxampphtdocsaztecgamesstudioapplibrariesCore.py", line 16, in __init__
self.getUrl()
File "c:devxampphtdocsaztecgamesstudioapplibrariesCore.py", line 21, in getUrl
data = requests.request("GET", link)
File "C:Python37libsite-packagesrequestsapi.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "C:Python37libsite-packagesrequestssessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "C:Python37libsite-packagesrequestssessions.py", line 668, in send
history = [resp for resp in gen] if allow_redirects else
File "C:Python37libsite-packagesrequestssessions.py", line 668, in <listcomp>
history = [resp for resp in gen] if allow_redirects else
File "C:Python37libsite-packagesrequestssessions.py", line 247, in resolve_redirects
**adapter_kwargs
File "C:Python37libsite-packagesrequestssessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "C:Python37libsite-packagesrequestsadapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=223): Max retries exceeded with url: /aztecgamesstudio/ (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000001FA877A9EB8>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))


Tried this code and got 301 response code



import requests
result = requests.get('http://localhost/aztecgamesstudio', allow_redirects=False)
print(result)









share|improve this question

























  • can you get it in browser?

    – Albin Paul
    Nov 17 '18 at 5:05











  • Yes the connection shows up fine in browser localhost/aztecgamesstudio

    – Mona
    Nov 17 '18 at 6:05













  • I tried the following code and I can access my localhost and all external webpages except my local webpage running on apache server. Why is that? I tried opening port 80 on firewall as well

    – Mona
    Nov 17 '18 at 14:05











  • open port 223 on the firewall, http port is already open

    – Albin Paul
    Nov 17 '18 at 14:09













  • Did that too in windows 10 defender inbound rules. Put script still not working. It is working fine for localhost but not localhost/aztecgamesstudio

    – Mona
    Nov 17 '18 at 15:30




















1















I tried the following code but get a connection exception. The same connection I can successfully establish using php. Any reason why my python code is throwing an error:



def getUrl(self):
link = 'http://localhost:80/aztecgamesstudio'
data = requests.request("GET", link)
url = data.url
print(url)

Traceback (most recent call last):
File "C:Python37libsite-packagesrequestsadapters.py", line 449, in send
timeout=timeout
File "C:Python37libsite-packagesurllib3connectionpool.py", line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File "C:Python37libsite-packagesurllib3utilretry.py", line 398, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=223): Max retries exceeded with url: /aztecgamesstudio/ (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000001FA877A9EB8>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:devxampphtdocsaztecgamesstudioapplibrariesCore.py", line 27, in <module>
init = Core()
File "c:devxampphtdocsaztecgamesstudioapplibrariesCore.py", line 16, in __init__
self.getUrl()
File "c:devxampphtdocsaztecgamesstudioapplibrariesCore.py", line 21, in getUrl
data = requests.request("GET", link)
File "C:Python37libsite-packagesrequestsapi.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "C:Python37libsite-packagesrequestssessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "C:Python37libsite-packagesrequestssessions.py", line 668, in send
history = [resp for resp in gen] if allow_redirects else
File "C:Python37libsite-packagesrequestssessions.py", line 668, in <listcomp>
history = [resp for resp in gen] if allow_redirects else
File "C:Python37libsite-packagesrequestssessions.py", line 247, in resolve_redirects
**adapter_kwargs
File "C:Python37libsite-packagesrequestssessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "C:Python37libsite-packagesrequestsadapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=223): Max retries exceeded with url: /aztecgamesstudio/ (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000001FA877A9EB8>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))


Tried this code and got 301 response code



import requests
result = requests.get('http://localhost/aztecgamesstudio', allow_redirects=False)
print(result)









share|improve this question

























  • can you get it in browser?

    – Albin Paul
    Nov 17 '18 at 5:05











  • Yes the connection shows up fine in browser localhost/aztecgamesstudio

    – Mona
    Nov 17 '18 at 6:05













  • I tried the following code and I can access my localhost and all external webpages except my local webpage running on apache server. Why is that? I tried opening port 80 on firewall as well

    – Mona
    Nov 17 '18 at 14:05











  • open port 223 on the firewall, http port is already open

    – Albin Paul
    Nov 17 '18 at 14:09













  • Did that too in windows 10 defender inbound rules. Put script still not working. It is working fine for localhost but not localhost/aztecgamesstudio

    – Mona
    Nov 17 '18 at 15:30
















1












1








1








I tried the following code but get a connection exception. The same connection I can successfully establish using php. Any reason why my python code is throwing an error:



def getUrl(self):
link = 'http://localhost:80/aztecgamesstudio'
data = requests.request("GET", link)
url = data.url
print(url)

Traceback (most recent call last):
File "C:Python37libsite-packagesrequestsadapters.py", line 449, in send
timeout=timeout
File "C:Python37libsite-packagesurllib3connectionpool.py", line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File "C:Python37libsite-packagesurllib3utilretry.py", line 398, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=223): Max retries exceeded with url: /aztecgamesstudio/ (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000001FA877A9EB8>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:devxampphtdocsaztecgamesstudioapplibrariesCore.py", line 27, in <module>
init = Core()
File "c:devxampphtdocsaztecgamesstudioapplibrariesCore.py", line 16, in __init__
self.getUrl()
File "c:devxampphtdocsaztecgamesstudioapplibrariesCore.py", line 21, in getUrl
data = requests.request("GET", link)
File "C:Python37libsite-packagesrequestsapi.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "C:Python37libsite-packagesrequestssessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "C:Python37libsite-packagesrequestssessions.py", line 668, in send
history = [resp for resp in gen] if allow_redirects else
File "C:Python37libsite-packagesrequestssessions.py", line 668, in <listcomp>
history = [resp for resp in gen] if allow_redirects else
File "C:Python37libsite-packagesrequestssessions.py", line 247, in resolve_redirects
**adapter_kwargs
File "C:Python37libsite-packagesrequestssessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "C:Python37libsite-packagesrequestsadapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=223): Max retries exceeded with url: /aztecgamesstudio/ (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000001FA877A9EB8>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))


Tried this code and got 301 response code



import requests
result = requests.get('http://localhost/aztecgamesstudio', allow_redirects=False)
print(result)









share|improve this question
















I tried the following code but get a connection exception. The same connection I can successfully establish using php. Any reason why my python code is throwing an error:



def getUrl(self):
link = 'http://localhost:80/aztecgamesstudio'
data = requests.request("GET", link)
url = data.url
print(url)

Traceback (most recent call last):
File "C:Python37libsite-packagesrequestsadapters.py", line 449, in send
timeout=timeout
File "C:Python37libsite-packagesurllib3connectionpool.py", line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File "C:Python37libsite-packagesurllib3utilretry.py", line 398, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=223): Max retries exceeded with url: /aztecgamesstudio/ (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000001FA877A9EB8>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:devxampphtdocsaztecgamesstudioapplibrariesCore.py", line 27, in <module>
init = Core()
File "c:devxampphtdocsaztecgamesstudioapplibrariesCore.py", line 16, in __init__
self.getUrl()
File "c:devxampphtdocsaztecgamesstudioapplibrariesCore.py", line 21, in getUrl
data = requests.request("GET", link)
File "C:Python37libsite-packagesrequestsapi.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "C:Python37libsite-packagesrequestssessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "C:Python37libsite-packagesrequestssessions.py", line 668, in send
history = [resp for resp in gen] if allow_redirects else
File "C:Python37libsite-packagesrequestssessions.py", line 668, in <listcomp>
history = [resp for resp in gen] if allow_redirects else
File "C:Python37libsite-packagesrequestssessions.py", line 247, in resolve_redirects
**adapter_kwargs
File "C:Python37libsite-packagesrequestssessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "C:Python37libsite-packagesrequestsadapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=223): Max retries exceeded with url: /aztecgamesstudio/ (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000001FA877A9EB8>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))


Tried this code and got 301 response code



import requests
result = requests.get('http://localhost/aztecgamesstudio', allow_redirects=False)
print(result)






python-3.x






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 17 '18 at 16:55







Mona

















asked Nov 17 '18 at 5:01









MonaMona

185




185













  • can you get it in browser?

    – Albin Paul
    Nov 17 '18 at 5:05











  • Yes the connection shows up fine in browser localhost/aztecgamesstudio

    – Mona
    Nov 17 '18 at 6:05













  • I tried the following code and I can access my localhost and all external webpages except my local webpage running on apache server. Why is that? I tried opening port 80 on firewall as well

    – Mona
    Nov 17 '18 at 14:05











  • open port 223 on the firewall, http port is already open

    – Albin Paul
    Nov 17 '18 at 14:09













  • Did that too in windows 10 defender inbound rules. Put script still not working. It is working fine for localhost but not localhost/aztecgamesstudio

    – Mona
    Nov 17 '18 at 15:30





















  • can you get it in browser?

    – Albin Paul
    Nov 17 '18 at 5:05











  • Yes the connection shows up fine in browser localhost/aztecgamesstudio

    – Mona
    Nov 17 '18 at 6:05













  • I tried the following code and I can access my localhost and all external webpages except my local webpage running on apache server. Why is that? I tried opening port 80 on firewall as well

    – Mona
    Nov 17 '18 at 14:05











  • open port 223 on the firewall, http port is already open

    – Albin Paul
    Nov 17 '18 at 14:09













  • Did that too in windows 10 defender inbound rules. Put script still not working. It is working fine for localhost but not localhost/aztecgamesstudio

    – Mona
    Nov 17 '18 at 15:30



















can you get it in browser?

– Albin Paul
Nov 17 '18 at 5:05





can you get it in browser?

– Albin Paul
Nov 17 '18 at 5:05













Yes the connection shows up fine in browser localhost/aztecgamesstudio

– Mona
Nov 17 '18 at 6:05







Yes the connection shows up fine in browser localhost/aztecgamesstudio

– Mona
Nov 17 '18 at 6:05















I tried the following code and I can access my localhost and all external webpages except my local webpage running on apache server. Why is that? I tried opening port 80 on firewall as well

– Mona
Nov 17 '18 at 14:05





I tried the following code and I can access my localhost and all external webpages except my local webpage running on apache server. Why is that? I tried opening port 80 on firewall as well

– Mona
Nov 17 '18 at 14:05













open port 223 on the firewall, http port is already open

– Albin Paul
Nov 17 '18 at 14:09







open port 223 on the firewall, http port is already open

– Albin Paul
Nov 17 '18 at 14:09















Did that too in windows 10 defender inbound rules. Put script still not working. It is working fine for localhost but not localhost/aztecgamesstudio

– Mona
Nov 17 '18 at 15:30







Did that too in windows 10 defender inbound rules. Put script still not working. It is working fine for localhost but not localhost/aztecgamesstudio

– Mona
Nov 17 '18 at 15:30














0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53348387%2funable-to-request-url-due-to-connection-error%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53348387%2funable-to-request-url-due-to-connection-error%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Xamarin.iOS Cant Deploy on Iphone

Glorious Revolution

Dulmage-Mendelsohn matrix decomposition in Python