Pythonanywhere proxy error

Hello, so I have this error on deployment, I don't know if it's due to the constraints of my deployment server (pythonanywhere) or if it's related to something else. My code works locally, but when I put it in my distant server and run it, it fails ...

Hello,

so I have this error on deployment, I don’t know if it’s due to the constraints of my deployment server (pythonanywhere) or if it’s related to something else.
My code works locally, but when I put it in my distant server and run it, it fails with a ClientConnectionError «Cannot connect to host [api_host]:443 ssl:default [Connect call failed (‘api_ip’, 443)]» where api_host/api_ip of another distant host I’m trying to contact with my code.
The exception is thrown from .local/lib/python3.8/site-packages/aiohttp/connector.py in _wrap_create_connection, line 943.

Is this a limitation of pythonanywhere regarding concurrent network calls ? (it works without the concurrent version). Or a python version problem ? Or something else ?

Please help me figuring out what’s wrong,

Thx

Posts: 7,842

Threads: 148

Joined: Sep 2016

Reputation:
572

Sep-21-2020, 02:19 PM
(This post was last modified: Sep-21-2020, 02:19 PM by buran.)

is it free account or paid one? free accounts are only allowed to connect to white-listed sites

lukee

Programmer named Tim


Posts: 13

Threads: 3

Joined: Sep 2020

Reputation:
0

It is a free account indeed, but it is part of the white-listed site, and works in sync mode. But I just coded an async version, and now it fails.

Posts: 96

Threads: 1

Joined: Apr 2018

Reputation:
9

I suggest trying it with verify_ssl = False in you aiohttp request

lukee

Programmer named Tim


Posts: 13

Threads: 3

Joined: Sep 2020

Reputation:
0

Thanks for the idea, but didn’t work. Anyway it wouldn’t have explained why it works locally and not on pythonanywhere, or why it works with the sync’ed version and not async’ed.

lukee

Programmer named Tim


Posts: 13

Threads: 3

Joined: Sep 2020

Reputation:
0

OKay so it appears pythonanywhere only sets up the http request, through a proxy (that whitelists some hosts though the one I’m interested in is whitelisted), and the websocket API that is used by aiohttp is not properly configured, so I get a connect failed error. Is there any way around that ?

Posts: 7,842

Threads: 148

Joined: Sep 2016

Reputation:
572

Sep-22-2020, 05:28 AM
(This post was last modified: Sep-22-2020, 05:28 AM by buran.)

(Sep-22-2020, 02:00 AM)lukee Wrote: it appears pythonanywhere only sets up the http request,

I am not sure this is true. On the plan comparing page they claim «Specific sites via HTTP(S) only»

lukee

Programmer named Tim


Posts: 13

Threads: 3

Joined: Sep 2020

Reputation:
0

Sep-23-2020, 01:37 AM
(This post was last modified: Sep-23-2020, 01:38 AM by lukee.)

It is true though, I’ve tried changing just one line from requests.get to session.get and in the later case it fails with a connect issue.
See here, here or here.

So is there a way to configure the proxy manually? How can they set this restriction anyway ?

In the end I need to be able to make multiple concurrent API calls, whatever the means.

Thx

lukee

Programmer named Tim


Posts: 13

Threads: 3

Joined: Sep 2020

Reputation:
0

lukee

Programmer named Tim


Posts: 13

Threads: 3

Joined: Sep 2020

Reputation:
0

I’m stuck on this question, it’s way past my knowledge, so if someone could help me I’d be grateful.

wekxy

Guest


  • #1

wekxy Asks: I am getting Proxy errors after deploying to pythonanywhere
I developed a web application that uses the Omdb API to import movie data into the database using json(), I have successfully deployed this project to PythonAnywhere, and the web app runs at first glance. However when I search a movie and then try to click on said movie to import to database and review, I get this error:

«HTTPSConnectionPool(host=’m.media-amazon.com’, port=443): Max retries exceeded with url: /images/M/MV5BMTIwMzExNDEwN15BMl5BanBnXkFtZTYwODMxMzg2._V1_SX300.jpg (Caused by ProxyError(‘Cannot connect to proxy.’, OSError(‘Tunnel connection failed: 403 Forbidden’)))»

Can anyone tell me what the problem is and how to solve this?

Also to add, when I run the application on my local machine and host, it runs successfully without any error. So I am guessing the error is from deploying.

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, solveforum.

  • xghkxghk
  • 24 minutes ago
  • Main forum
  • Replies: 0

Customized Magnetic Active Buzzer Technical parameters Measuring condition Part shall be measured under a condition (Temperature: 5锝?5鈩? Humidity: 45%锝?5%R.H., Atmospheric pressure: 860 锝?060hPa) unless the standard condition (Temperature: 25卤3鈩? Humidity: 60卤10%R.H. Atmospheric pressure: 860 锝?060hPa) is regulated to measure. 1Rated Voltage3Vo-p 2Operating Voltage2-5Vo-p 3Rated CurrentMax.80mA, at 2048Hz 50% duty Square Wave 3Vo-p 4Sound Output at 10cmMin.85dB, at 2048Hz 50% duty Square Wave 3Vo-p 5Coil Resistance16卤4惟 6Resonant Frequency2048Hz 7Operating Temperature-20鈩冿綖+70鈩?/p> 8Store Temperature-30鈩冿綖+80鈩?/p> 9Net WeightApprox 1.6g 10RoHSYes DRAWING & DIMENSION *Unit: mm; Tolerance: 卤0.5mm Except Specified *Housing Material: Black PBT Frequency Response 3Vo-p 50% duty Square wave,10cm Packing Application Delivery, shipping and service Advantage 1. Technology: We owned injection mould workshop, 3D printer, 3 meter anechoic room, to help customer products and effectively shorten the customer developing time. 2. Patent: We are a innovation-driven company, we have 25 patents include with 2 patents for invention 3. Rich production experience: We specialize in the production of buzzers, speaker alarms and ultrasonic sensors with 25 years of experience. FAQ Q: Are you trading company or manufacturer ? A: We are manufacture ,and we have built up our company since 2010 Q: Do you support OEM and ODM services锛?/strong> A: Yes, surely support.we can customize products according to the drawing.Customized Magnetic Active Buzzer website:http://www.czfhds.com/magnetic-buzzer/magnetic-active-buzzer/

  • Sam
  • 29 minutes ago
  • Social
  • Replies: 0

Sam Asks: Clavinova CLP-230 M
I’m looking at a used Clavinova CLP-230M (thats what I was told was the model). Looks like in good nick. Any idea what I should be paying for it?

Thanks

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your thoughts here to help others.

  • Larry G. Wapnitsky
  • 29 minutes ago
  • Social
  • Replies: 0

Larry G. Wapnitsky Asks: Upgrading to LED. Tombstone question
I am upgrading the bulbs in an old fluorescent work light to LED bulbs. I have pulled the ballasts, and remove the starters from the Tombstones pictured below. Is it safe to use these tombstones without the starters in them, or is there a replacement I should look for?

enter image description here

enter image description here

enter image description here

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your thoughts here to help others.

  • Sega dude
  • 29 minutes ago
  • Computer Science
  • Replies: 0

Sega dude Asks: Definition of the term «small systems» in computer science
What is the definition of the term «small systems» in the context of computer science? My professor didn’t really define the term, they just gave examples of some small systems. I’m having a hard time finding a concrete definition of the term online. This is not a homework question. I just want to know the definition so I can better understand the course.

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your thoughts here to help others.

  • pron
  • 29 minutes ago
  • Computer Science
  • Replies: 0

pron Asks: What is the complexity for the universality problem for a NFA with all states accepting?
It is well known that the universality problem for NFA (deciding whether $L(A)=Sigma^*$) is $PSPACE$-complete. However, what if every state of the NFA is known to be accepting? It seems to me that the problem is at most in $co$-$NP$, as a counterexample (unlike in the case of a general NFA) is polynomial (even linear) in the size of the input (the number of states). What is the complexity of this problem?

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your thoughts here to help others.

  • George
  • 29 minutes ago
  • Education
  • Replies: 0

George Asks: Expectation of squared integral over distribution
Right now, I have some function $g(x)$ where $E[g(x)]$ is known, and I want to upper bound (or compute if at all possible) $I=Eleft[left(int g(x)^frac{1}{2},dP_x right)^2right]$

What I tried:

First divide up the integral as a double integral $I=Eleft[iint g(x)^frac{1}{2} g(y)^frac{1}{2},dP_xdP_y right]$ where $x$ and $y$ have identical distributions, then pull in the expectation $I=iint Eleft[g(x)^frac{1}{2} g(y)^frac{1}{2}right],dP_xdP_y $. Then, split the expectation by the product $I=iint Eleft[g(x)^frac{1}{2}right] Eleft[g(y)^frac{1}{2}right],dP_xdP_y $, and then use Jensen’s equality to finish with $I<iint Eleft[g(x)right]^frac{1}{2} Eleft[g(y)right]^frac{1}{2},dP_xdP_y$, where this bound is computed by Monte Carlo approximation

However, I am not sure about the assumptions I’ve made in getting to the end result, nor do I feel this bound is very sharp or efficient- did I make any mistakes along the way, and/or is there a better way of handling this?

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your thoughts here to help others.

  • awesome6uy
  • 29 minutes ago
  • Education
  • Replies: 0

awesome6uy Asks: Statistical test for significant change in regression parameter with new data?
Is there a statistical test that determines if there is a significant change in a regression coefficient parameter’s value when more data is added?

For example, you have 11 months of data, fit a regression model for variable x1 which has an estimated coefficient of 0.8. Next month, you get another set of data and refit the model using the full 12 months of data and get a coefficient of 0.9.

How do I tell if there is a significant change in this parameter value between the two models?

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your thoughts here to help others.

Я пытаюсь развернуть мое приложение на pythonanywhere, но я не могу подключиться к твиттеру.

Вот ошибка, которую я получаю: —

Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1687, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1360, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1358, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1344, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/home/btpraasta/btp_raasta/runServer.py", line 178, in remainingRequests
return (str)(getTrend.get_remainingRequests())
File "/home/btpraasta/btp_raasta/python/getTrend.py", line 20, in get_remainingRequests
data = get_json(url)
File "/home/btpraasta/btp_raasta/python/getTrend.py", line 10, in get_json
connection = urllib.urlopen(url, proxies=proxies)
File "/usr/lib/python2.7/urllib.py", line 87, in urlopen
return opener.open(url)
File "/usr/lib/python2.7/urllib.py", line 208, in open
return getattr(self, name)(url)
File "/usr/lib/python2.7/urllib.py", line 437, in open_https
h.endheaders(data)
File "/usr/lib/python2.7/httplib.py", line 975, in endheaders
self._send_output(message_body)
File "/usr/lib/python2.7/httplib.py", line 835, in _send_output
self.send(msg)
File "/usr/lib/python2.7/httplib.py", line 797, in send
self.connect()
File "/usr/lib/python2.7/httplib.py", line 1178, in connect
self.timeout, self.source_address)
File "/usr/lib/python2.7/socket.py", line 571, in create_connection
raise err
IOError: [Errno socket error] [Errno 111] Connection refused

Код, который я пытаюсь запустить, следующий:

proxies = {'http': 'http://proxy.server:3128'}
connection = urllib.urlopen(url, proxies=proxies)
data = connection.read()

И я пытаюсь получить доступ к следующему URL-адресу: — https://api.twitter.com/1.1/application/rate_limit_status.json ‘

У меня есть бесплатная учетная запись на pythonanywhere и проверена, что API включен в белый список, и я использую прокси-сервер, как описано здесь (http://help.pythonanywhere.com/pages/403ForbiddenError).

Hi all,

I wrote a small script to get some data from an API, which works fine in jupyter notebook on my laptop: https://imgur.com/a/yzzSbHI

However, when I try to run the same script in pythonanywhere.com’s console, I get the following error:

>>> from requests import get

>>>

>>> #url = ‘https://rsbuddy.com/exchange/names.json’

… url = ‘https://rsbuddy.com/exchange/summary.json’

>>> data = get(url).json()

Traceback (most recent call last):

File «/usr/lib/python3.7/site-packages/urllib3/connectionpool.py», line 594, in urlopen

self._prepare_proxy(conn)

File «/usr/lib/python3.7/site-packages/urllib3/connectionpool.py», line 815, in _prepare_proxy

conn.connect()

File «/usr/lib/python3.7/site-packages/urllib3/connection.py», line 324, in connect

self._tunnel()

File «/usr/lib/python3.7/http/client.py», line 911, in _tunnel

message.strip()))

OSError: Tunnel connection failed: 403 Forbidden

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File «/usr/lib/python3.7/site-packages/requests/adapters.py», line 445, in send

timeout=timeout

File «/usr/lib/python3.7/site-packages/urllib3/connectionpool.py», line 638, in urlopen

_stacktrace=sys.exc_info()[2])

File «/usr/lib/python3.7/site-packages/urllib3/util/retry.py», line 398, in increment

raise MaxRetryError(_pool, url, error or ResponseError(cause))

urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host=’rsbuddy.com’, port=443): Max retries exceeded with url: /exchange/summary.json (Caused b

y ProxyError(‘Cannot connect to proxy.’, OSError(‘Tunnel connection failed: 403 Forbidden’)))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File «<stdin>», line 1, in <module>

File «/usr/lib/python3.7/site-packages/requests/api.py», line 72, in get

return request(‘get’, url, params=params, **kwargs)

File «/usr/lib/python3.7/site-packages/requests/api.py», line 58, in request

return session.request(method=method, url=url, **kwargs)

File «/usr/lib/python3.7/site-packages/requests/sessions.py», line 512, in request

resp = self.send(prep, **send_kwargs)

File «/usr/lib/python3.7/site-packages/requests/sessions.py», line 622, in send

r = adapter.send(request, **kwargs)

File «/usr/lib/python3.7/site-packages/requests/adapters.py», line 507, in send

raise ProxyError(e, request=request)

requests.exceptions.ProxyError: HTTPSConnectionPool(host=’rsbuddy.com’, port=443): Max retries exceeded with url: /exchange/summary.json (Caused by

ProxyError(‘Cannot connect to proxy.’, OSError(‘Tunnel connection failed: 403 Forbidden’)))

I honestly don’t know what to make of this.. Any help would be appreciated!

uploaded telegram echo bot to pythonanywhere
gives an error message

(venv) 08:28 ~/bott $ python bot1.py 
Goodbye!
Traceback (most recent call last):
  File "/home/akshin17/venv/lib/python3.8/site-packages/aiohttp/connector.py", line 969, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)  # type: ignore  # noqa
  File "/usr/lib/python3.8/asyncio/base_events.py", line 1017, in create_connection
    raise exceptions[0]
  File "/usr/lib/python3.8/asyncio/base_events.py", line 1002, in create_connection
    sock = await self._connect_sock(
  File "/usr/lib/python3.8/asyncio/base_events.py", line 916, in _connect_sock
    await self.sock_connect(sock, address)
  File "/usr/lib/python3.8/asyncio/selector_events.py", line 485, in sock_connect
    return await fut
  File "/usr/lib/python3.8/asyncio/selector_events.py", line 490, in _sock_connect
    sock.connect(address)
OSError: [Errno 101] Network is unreachable

The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/home/akshin17/venv/lib/python3.8/site-packages/aiogram/bot/api.py", line 139, in make_request
    async with session.post(url, data=req, **kwargs) as response:
  File "/home/akshin17/venv/lib/python3.8/site-packages/aiohttp/client.py", line 1117, in __aenter__
    self._resp = await self._coro
  File "/home/akshin17/venv/lib/python3.8/site-packages/aiohttp/client.py", line 520, in _request
    conn = await self._connector.connect(
  File "/home/akshin17/venv/lib/python3.8/site-packages/aiohttp/connector.py", line 535, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/home/akshin17/venv/lib/python3.8/site-packages/aiohttp/connector.py", line 892, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
  File "/home/akshin17/venv/lib/python3.8/site-packages/aiohttp/connector.py", line 1051, in _create_direct_connection
    raise last_exc
  File "/home/akshin17/venv/lib/python3.8/site-packages/aiohttp/connector.py", line 1020, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
  File "/home/akshin17/venv/lib/python3.8/site-packages/aiohttp/connector.py", line 975, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host api.telegram.org:443 ssl:default [Network is unreachable]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "bot1.py", line 21, in <module>
    executor.start_polling(dp, skip_updates=True)
  File "/home/akshin17/venv/lib/python3.8/site-packages/aiogram/utils/executor.py", line 41, in start_polling
    executor.start_polling(reset_webhook=reset_webhook, timeout=timeout, relax=relax, fast=fast)
  File "/home/akshin17/venv/lib/python3.8/site-packages/aiogram/utils/executor.py", line 309, in start_polling
    loop.run_until_complete(self._startup_polling())
  File "/usr/lib/python3.8/asyncio/base_events.py", line 608, in run_until_complete
    return future.result()
  File "/home/akshin17/venv/lib/python3.8/site-packages/aiogram/utils/executor.py", line 360, in _startup_polling
    await self._welcome()
  File "/home/akshin17/venv/lib/python3.8/site-packages/aiogram/utils/executor.py", line 350, in _welcome
    user = await self.dispatcher.bot.me
  File "/home/akshin17/venv/lib/python3.8/site-packages/aiogram/bot/bot.py", line 29, in me
    setattr(self, '_me', await self.get_me())
  File "/home/akshin17/venv/lib/python3.8/site-packages/aiogram/bot/bot.py", line 217, in get_me
    result = await self.request(api.Methods.GET_ME, payload)
  File "/home/akshin17/venv/lib/python3.8/site-packages/aiogram/bot/base.py", line 208, in request
    return await api.make_request(self.session, self.server, self.__token, method, data, files,
  File "/home/akshin17/venv/lib/python3.8/site-packages/aiogram/bot/api.py", line 142, in make_request
    raise exceptions.NetworkError(f"aiohttp client throws an error: {e.__class__.__name__}: {e}")
aiogram.utils.exceptions.NetworkError: Aiohttp client throws an error: ClientConnectorError: Cannot connect to host api.telegram.org:443 ssl:default [Network is u
nreachable]

how to get rid of the error

Понравилась статья? Поделить с друзьями:
  • Qsqlquery get error
  • Pythonanywhere oserror write error
  • Qsoundeffect qaudio error decoding source
  • Python39 dll ошибка
  • Python35 dll ошибка