Google Translate API logging permission denied - python

I am using the Google Translate API v2 and I am able to get the translations but I also get these errors on the side which I am not able to resolve.
Failed to submit 1 logs.
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/google/api_core/grpc_helpers.py", line 67, in error_remapped_callable
return callable_(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/grpc/_channel.py", line 946, in __call__
return _end_unary_response_blocking(state, call, False, None)
File "/usr/local/lib/python3.7/site-packages/grpc/_channel.py", line 849, in _end_unary_response_blocking
raise _InactiveRpcError(state)
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
status = StatusCode.PERMISSION_DENIED
details = "Permission 'logging.logEntries.create' denied on resource (or it may not exist)."
debug_error_string = "{"created":"#1659523475.735415900","description":"Error received from peer ipv4:142.250.194.234:443","file":"src/core/lib/surface/call.cc","file_line":966,"grpc_message":"Permission 'logging.logEntries.create' denied on resource (or it may not exist).","grpc_status":7}"
>
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/google/cloud/logging_v2/handlers/transports/background_thread.py", line 114, in _safely_commit_batch
batch.commit()
File "/usr/local/lib/python3.7/site-packages/google/cloud/logging_v2/logger.py", line 385, in commit
client.logging_api.write_entries(entries, **kwargs)
File "/usr/local/lib/python3.7/site-packages/google/cloud/logging_v2/_gapic.py", line 149, in write_entries
self._gapic_api.write_log_entries(request=request)
File "/usr/local/lib/python3.7/site-packages/google/cloud/logging_v2/services/logging_service_v2/client.py", line 615, in write_log_entries
metadata=metadata,
File "/usr/local/lib/python3.7/site-packages/google/api_core/gapic_v1/method.py", line 145, in __call__
return wrapped_func(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/google/api_core/retry.py", line 291, in retry_wrapped_func
on_error=on_error,
File "/usr/local/lib/python3.7/site-packages/google/api_core/retry.py", line 189, in retry_target
return target()
File "/usr/local/lib/python3.7/site-packages/google/api_core/grpc_helpers.py", line 69, in error_remapped_callable
six.raise_from(exceptions.from_grpc_error(exc), exc)
File "<string>", line 3, in raise_from
google.api_core.exceptions.PermissionDenied: 403 Permission 'logging.logEntries.create' denied on resource (or it may not exist).
Failed to submit 1 logs.
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/google/api_core/grpc_helpers.py", line 67, in error_remapped_callable
return callable_(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/grpc/_channel.py", line 946, in __call__
return _end_unary_response_blocking(state, call, False, None)
File "/usr/local/lib/python3.7/site-packages/grpc/_channel.py", line 849, in _end_unary_response_blocking
raise _InactiveRpcError(state)
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
status = StatusCode.PERMISSION_DENIED
details = "Permission 'logging.logEntries.create' denied on resource (or it may not exist)."
debug_error_string = "{"created":"#1659523476.318220100","description":"Error received from peer ipv4:142.250.194.234:443","file":"src/core/lib/surface/call.cc","file_line":966,"grpc_message":"Permission 'logging.logEntries.create' denied on resource (or it may not exist).","grpc_status":7}"
>
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/google/cloud/logging_v2/handlers/transports/background_thread.py", line 114, in _safely_commit_batch
batch.commit()
File "/usr/local/lib/python3.7/site-packages/google/cloud/logging_v2/logger.py", line 385, in commit
client.logging_api.write_entries(entries, **kwargs)
File "/usr/local/lib/python3.7/site-packages/google/cloud/logging_v2/_gapic.py", line 149, in write_entries
self._gapic_api.write_log_entries(request=request)
File "/usr/local/lib/python3.7/site-packages/google/cloud/logging_v2/services/logging_service_v2/client.py", line 615, in write_log_entries
metadata=metadata,
File "/usr/local/lib/python3.7/site-packages/google/api_core/gapic_v1/method.py", line 145, in __call__
return wrapped_func(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/google/api_core/retry.py", line 291, in retry_wrapped_func
on_error=on_error,
File "/usr/local/lib/python3.7/site-packages/google/api_core/retry.py", line 189, in retry_target
return target()
File "/usr/local/lib/python3.7/site-packages/google/api_core/grpc_helpers.py", line 69, in error_remapped_callable
six.raise_from(exceptions.from_grpc_error(exc), exc)
File "<string>", line 3, in raise_from
google.api_core.exceptions.PermissionDenied: 403 Permission 'logging.logEntries.create' denied on resource (or it may not exist).
I am guesing that this issue is because of the logging but I am not able to turn off the logging. I used the following reference - https://cloud.google.com/translate/docs/basic/translating-text#translating_text and the Python code mentioned here.
I am writing the code inside Django.

It looks like your Python client is attempting to write in Google Cloud log.
Either this is a feature / setting in your client (that you might want to disable), or you might want to add the permission to your API keys to allow the API key to write in Google Cloud Log

Related

Problems with pythonanywhere [duplicate]

I made a Discord Bot using Python 3.6. It runs and behaves perfectly when run on my computer, yet when I run it on PythonAnywhere, I get this message. I installed Discord.py and all necessary modules. Please help. I am not that very good with complex programming talk, and not at all good with web talk, so please answer as simply as you can. Does this issue only happen with PythonAnywhere or all remote hosting sites?
01:42 ~ $ python3.6 MyCoolBot.py
Traceback (most recent call last):
File "/home/CompuGenius/.local/lib/python3.6/site-packages/aiohttp/connector.py", line 601, in _create_direc
t_connection
local_addr=self._local_addr)
File "/usr/lib/python3.6/asyncio/base_events.py", line 778, in create_connection
raise exceptions[0]
File "/usr/lib/python3.6/asyncio/base_events.py", line 765, in create_connection
yield from self.sock_connect(sock, address)
File "/usr/lib/python3.6/asyncio/selector_events.py", line 450, in sock_connect
return (yield from fut)
File "/usr/lib/python3.6/asyncio/selector_events.py", line 480, in _sock_connect_cb
raise OSError(err, 'Connect call failed %s' % (address,))
ConnectionRefusedError: [Errno 111] Connect call failed ('104.16.58.5', 443)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/CompuGenius/.local/lib/python3.6/site-packages/aiohttp/connector.py", line 304, in connect
yield from self._create_connection(req)
File "/home/CompuGenius/.local/lib/python3.6/site-packages/aiohttp/connector.py", line 578, in _create_conne
ction
transport, proto = yield from self._create_direct_connection(req)
File "/home/CompuGenius/.local/lib/python3.6/site-packages/aiohttp/connector.py", line 624, in _create_direc
t_connection
(req.host, req.port, exc.strerror)) from exc
aiohttp.errors.ClientOSError: [Errno 111] Can not connect to discordapp.com:443 [Connect call failed ('104.16.
58.5', 443)]
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "MyCoolBot.py", line 39, in <module>
client.run('MY_BOT_TOKEN')
File "/home/CompuGenius/.local/lib/python3.6/site-packages/discord/client.py", line 519, in run
self.loop.run_until_complete(self.start(*args, **kwargs))
File "/usr/lib/python3.6/asyncio/base_events.py", line 468, in run_until_complete
return future.result()
File "/home/CompuGenius/.local/lib/python3.6/site-packages/discord/client.py", line 490, in start
yield from self.login(*args, **kwargs)
File "/home/CompuGenius/.local/lib/python3.6/site-packages/discord/client.py", line 416, in login
yield from getattr(self, '_login_' + str(n))(*args, **kwargs)
File "/home/CompuGenius/.local/lib/python3.6/site-packages/discord/client.py", line 346, in _login_1
data = yield from self.http.static_login(token, bot=is_bot)
File "/home/CompuGenius/.local/lib/python3.6/site-packages/discord/http.py", line 258, in static_login
data = yield from self.request(Route('GET', '/users/#me'))
File "/home/CompuGenius/.local/lib/python3.6/site-packages/discord/http.py", line 137, in request
r = yield from self.session.request(method, url, **kwargs)
File "/home/CompuGenius/.local/lib/python3.6/site-packages/aiohttp/client.py", line 555, in __iter__
resp = yield from self._coro
File "/home/CompuGenius/.local/lib/python3.6/site-packages/aiohttp/client.py", line 198, in _request
conn = yield from self._connector.connect(req)
File "/home/CompuGenius/.local/lib/python3.6/site-packages/aiohttp/connector.py", line 314, in connect
.format(key, exc.strerror)) from exc
aiohttp.errors.ClientOSError: [Errno 111] Cannot connect to host discordapp.com:443 ssl:True [Can not connect to discordapp.com:443 [Connect call failed ('104.16.58.5', 443)]]
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f4b25d81be0>
This is because PythonAnywhere requires a proxy in such a way that the aiohttp websockets don't support. There's a thread on their forums about it here: https://www.pythonanywhere.com/forums/topic/7384/ (See #Patrick Haugh's comment above)

Google App Engine RPC error writing to datastore

I have a simple Google App Engine web app that runs fine in my local development environment (including being able to post to the datastore), but when deployed to Google App Engine I get the following error messages in the console.
Note that the second traceback is abridged - above it is a call to the put method of the datastore.Client() instance.
I have tried re-deploying and have tried googling the error messages but no luck so far. Is there somewhere I need to tell GAE that my app should have permission to the datastore?
Any pointers much appreciated.
Traceback (most recent call last):
File "/env/lib/python3.7/site-packages/google/api_core/grpc_helpers.py", line 57, in error_remapped_callable
return callable_(*args, **kwargs)
File "/env/lib/python3.7/site-packages/grpc/_channel.py", line 923, in __call__
return _end_unary_response_blocking(state, call, False, None)
File "/env/lib/python3.7/site-packages/grpc/_channel.py", line 826, in _end_unary_response_blocking
raise _InactiveRpcError(state)
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
File "/layers/google.python.pip/pip/google/cloud/datastore/client.py", line 565, in put
self.put_multi(entities=[entity], retry=retry, timeout=timeout)
File "/layers/google.python.pip/pip/google/cloud/datastore/client.py", line 605, in put_multi
current.commit(retry=retry, timeout=timeout)
File "/layers/google.python.pip/pip/google/cloud/datastore/batch.py", line 293, in commit
self._commit(retry=retry, timeout=timeout)
File "/layers/google.python.pip/pip/google/cloud/datastore/batch.py", line 257, in _commit
commit_response_pb = self._client._datastore_api.commit(
File "/layers/google.python.pip/pip/google/cloud/datastore_v1/gapic/datastore_client.py", line 645, in commit
return self._inner_api_calls["commit"](
File "/layers/google.python.pip/pip/google/api_core/gapic_v1/method.py", line 145, in __call__
return wrapped_func(*args, **kwargs)
File "/layers/google.python.pip/pip/google/api_core/retry.py", line 281, in retry_wrapped_func
return retry_target(
File "/layers/google.python.pip/pip/google/api_core/retry.py", line 184, in retry_target
return target()
File "/layers/google.python.pip/pip/google/api_core/timeout.py", line 214, in func_with_timeout
return func(*args, **kwargs)
File "/layers/google.python.pip/pip/google/api_core/grpc_helpers.py", line 59, in error_remapped_callable
six.raise_from(exceptions.from_grpc_error(exc), exc)
File "<string>", line 3, in raise_from
google.api_core.exceptions.PermissionDenied: 403 Missing or insufficient permissions.
Your account that runs the app (probably your App Engine service account) should have the required permissions for the Datastore. Please give roles/datastore.user as described here

Can't establish a connection using snowflake-connector-python v1.9

(Asking the following question on behalf of a client)
............
Due to the size of all dependencies snowflake-connector-python is having I had to switch to v1.9 (106Mb total size) and now I'm not able to establish connection, v2.0 is not functioning as well. The only working version is v2.0.1 but it's huge (320Mb total size) comparing to the v1.9.
Traceback (most recent call last):
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/ocsp_snowflake.py", line 1131, in validate_by_direct_connection
self.process_ocsp_response(issuer, cert_id, ocsp_response)
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/ocsp_asn1crypto.py", line 280, in process_ocsp_response
tbs_response_data)
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/ocsp_asn1crypto.py", line 316, in verify_signature
pubkey = cert.public_key.unwrap().dump()
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/asn1crypto/keys.py", line 1065, in unwrap
'asn1crypto.keys.PublicKeyInfo().unwrap() has been removed, '
asn1crypto._errors.APIException: asn1crypto.keys.PublicKeyInfo().unwrap() has been removed, please use oscrypto.asymmetric.PublicKey().unwrap() instead
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/network.py", line 790, in _request_exec
auth=SnowflakeAuth(token),
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/botocore/vendored/requests/sessions.py", line 465, in request
resp = self.send(prep, **send_kwargs)
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/botocore/vendored/requests/sessions.py", line 573, in send
r = adapter.send(request, **kwargs)
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/botocore/vendored/requests/adapters.py", line 370, in send
timeout=timeout
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/botocore/vendored/requests/packages/urllib3/connectionpool.py", line 544, in urlopen
body=body, headers=headers)
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/botocore/vendored/requests/packages/urllib3/connectionpool.py", line 341, in _make_request
self._validate_conn(conn)
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/botocore/vendored/requests/packages/urllib3/connectionpool.py", line 761, in _validate_conn
conn.connect()
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/botocore/vendored/requests/packages/urllib3/connection.py", line 238, in connect
ssl_version=resolved_ssl_version)
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/ssl_wrap_socket.py", line 395, in ssl_wrap_socket_with_ocsp
).validate(server_hostname, ret.connection)
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/ocsp_snowflake.py", line 996, in validate
return self._validate(hostname, cert_data, telemetry_data, do_retry, no_exception)
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/ocsp_snowflake.py", line 1002, in _validate
cert_data, telemetry_data, hostname, do_retry=do_retry)
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/ocsp_snowflake.py", line 1184, in _validate_certificates_sequential
issuer, subject, telemetry_data, hostname, do_retry=do_retry)
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/ocsp_snowflake.py", line 1153, in validate_by_direct_connection
err = self.verify_fail_open(ex, telemetry_data)
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/ocsp_snowflake.py", line 1166, in verify_fail_open
if ex_obj.errno is ER_SERVER_CERTIFICATE_REVOKED:
AttributeError: 'APIException' object has no attribute 'errno'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/network.py", line 640, in _request_exec_wrapper
**kwargs)
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/network.py", line 883, in _request_exec
raise RetryRequest(err)
snowflake.connector.network.RetryRequest: 'APIException' object has no attribute 'errno'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/avinogradov/git/crux/step_function/snowflake_update/test.py", line 25, in <module>
schema=SCHEMA
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/__init__.py", line 33, in Connect
return SnowflakeConnection(**kwargs)
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/connection.py", line 187, in __init__
self.connect(**kwargs)
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/connection.py", line 484, in connect
self.__open_connection()
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/connection.py", line 700, in __open_connection
self.__authenticate(auth_instance)
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/connection.py", line 931, in __authenticate
session_parameters=self._session_parameters,
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/auth.py", line 197, in authenticate
socket_timeout=self._rest._connection.login_timeout)
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/network.py", line 521, in _post_request
_include_retry_params=_include_retry_params)
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/network.py", line 600, in fetch
**kwargs)
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/network.py", line 683, in _request_exec_wrapper
conn, full_url, cause)
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/network.py", line 713, in handle_invalid_certificate_error
u'errno': ER_FAILED_TO_REQUEST,
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/errors.py", line 100, in errorhandler_wrapper
connection.errorhandler(connection, cursor, errorclass, errorvalue)
File "/Users/avinogradov/.local/share/virtualenvs/snowflake_update-WVrmvZbT/lib/python3.7/site-packages/snowflake/connector/errors.py", line 73, in default_errorhandler
done_format_msg=errorvalue.get(u'done_format_msg'))
snowflake.connector.errors.OperationalError: 250003: Failed to execute request: 'APIException' object has no attribute 'errno'
............
The client is currently able to get around the issue by using the latest version (2.0.1) but to delete pyarrow and numpy (pip uninstall pyarrow numpy) later to reduce dependencies size (these dependencies are used by customers who are on the Private Preview only).
Are there any better recommendations out there?
You are correct that this is an issue that was fixed in v2.0.1. The older versions of the Python connector are failing while validating the certificate using the recently upgraded package of asn1crypto 1.0.0. The workaround is to use asn1crypt 0.24.0.
pip install snowflake-connector-python asn1crypto==0.24.0

Error When Running my Discord Bot on Python Anywhere

I made a Discord Bot using Python 3.6. It runs and behaves perfectly when run on my computer, yet when I run it on PythonAnywhere, I get this message. I installed Discord.py and all necessary modules. Please help. I am not that very good with complex programming talk, and not at all good with web talk, so please answer as simply as you can. Does this issue only happen with PythonAnywhere or all remote hosting sites?
01:42 ~ $ python3.6 MyCoolBot.py
Traceback (most recent call last):
File "/home/CompuGenius/.local/lib/python3.6/site-packages/aiohttp/connector.py", line 601, in _create_direc
t_connection
local_addr=self._local_addr)
File "/usr/lib/python3.6/asyncio/base_events.py", line 778, in create_connection
raise exceptions[0]
File "/usr/lib/python3.6/asyncio/base_events.py", line 765, in create_connection
yield from self.sock_connect(sock, address)
File "/usr/lib/python3.6/asyncio/selector_events.py", line 450, in sock_connect
return (yield from fut)
File "/usr/lib/python3.6/asyncio/selector_events.py", line 480, in _sock_connect_cb
raise OSError(err, 'Connect call failed %s' % (address,))
ConnectionRefusedError: [Errno 111] Connect call failed ('104.16.58.5', 443)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/CompuGenius/.local/lib/python3.6/site-packages/aiohttp/connector.py", line 304, in connect
yield from self._create_connection(req)
File "/home/CompuGenius/.local/lib/python3.6/site-packages/aiohttp/connector.py", line 578, in _create_conne
ction
transport, proto = yield from self._create_direct_connection(req)
File "/home/CompuGenius/.local/lib/python3.6/site-packages/aiohttp/connector.py", line 624, in _create_direc
t_connection
(req.host, req.port, exc.strerror)) from exc
aiohttp.errors.ClientOSError: [Errno 111] Can not connect to discordapp.com:443 [Connect call failed ('104.16.
58.5', 443)]
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "MyCoolBot.py", line 39, in <module>
client.run('MY_BOT_TOKEN')
File "/home/CompuGenius/.local/lib/python3.6/site-packages/discord/client.py", line 519, in run
self.loop.run_until_complete(self.start(*args, **kwargs))
File "/usr/lib/python3.6/asyncio/base_events.py", line 468, in run_until_complete
return future.result()
File "/home/CompuGenius/.local/lib/python3.6/site-packages/discord/client.py", line 490, in start
yield from self.login(*args, **kwargs)
File "/home/CompuGenius/.local/lib/python3.6/site-packages/discord/client.py", line 416, in login
yield from getattr(self, '_login_' + str(n))(*args, **kwargs)
File "/home/CompuGenius/.local/lib/python3.6/site-packages/discord/client.py", line 346, in _login_1
data = yield from self.http.static_login(token, bot=is_bot)
File "/home/CompuGenius/.local/lib/python3.6/site-packages/discord/http.py", line 258, in static_login
data = yield from self.request(Route('GET', '/users/#me'))
File "/home/CompuGenius/.local/lib/python3.6/site-packages/discord/http.py", line 137, in request
r = yield from self.session.request(method, url, **kwargs)
File "/home/CompuGenius/.local/lib/python3.6/site-packages/aiohttp/client.py", line 555, in __iter__
resp = yield from self._coro
File "/home/CompuGenius/.local/lib/python3.6/site-packages/aiohttp/client.py", line 198, in _request
conn = yield from self._connector.connect(req)
File "/home/CompuGenius/.local/lib/python3.6/site-packages/aiohttp/connector.py", line 314, in connect
.format(key, exc.strerror)) from exc
aiohttp.errors.ClientOSError: [Errno 111] Cannot connect to host discordapp.com:443 ssl:True [Can not connect to discordapp.com:443 [Connect call failed ('104.16.58.5', 443)]]
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f4b25d81be0>
This is because PythonAnywhere requires a proxy in such a way that the aiohttp websockets don't support. There's a thread on their forums about it here: https://www.pythonanywhere.com/forums/topic/7384/ (See #Patrick Haugh's comment above)

gevent timeout error on socket.io connection

I have a setup containing varnish nginx and 2 pyramid backends one of them running socket.io app. All the stack works correctly on my local development computer, but i can't get to work the websocket part on the production computer. The traceback of the error that trows the socketio app when a client socket.io tries to connect:
[2012-11-20 14:32:00] "GET /socket.io/1/websocket/790777701707 HTTP/1.1" 101 - -
Traceback (most recent call last):
File "/var/pyramid/maxserver/eggs/gevent-0.13.8-py2.7-linux-i686.egg/gevent/greenlet.py", line 390, in run
result = self._run(*self.args, **self.kwargs)
File "/var/pyramid/maxserver/eggs/gevent_socketio-0.3.5_rc2-py2.7.egg/socketio/transports.py", line 226, in send_into_ws
websocket.send(message)
File "/var/pyramid/maxserver/eggs/gevent_websocket-0.3.6-py2.7.egg/geventwebsocket/websocket.py", line 350, in send
return self.send_frame(message, self.OPCODE_TEXT)
File "/var/pyramid/maxserver/eggs/gevent_websocket-0.3.6-py2.7.egg/geventwebsocket/websocket.py", line 340, in send_frame
self._write(combined)
File "/var/pyramid/maxserver/eggs/gevent-0.13.8-py2.7-linux-i686.egg/gevent/socket.py", line 515, in sendall
data_sent += self.send(_get_memory(data, data_sent), flags, timeout=timeleft)
File "/var/pyramid/maxserver/eggs/gevent-0.13.8-py2.7-linux-i686.egg/gevent/socket.py", line 483, in send
return sock.send(data, flags)
error: [Errno 32] Broken pipe
<Greenlet at 0xa449c0c: send_into_ws> failed with error
Traceback (most recent call last):
File "/var/pyramid/maxserver/eggs/gevent-0.13.8-py2.7-linux-i686.egg/gevent/greenlet.py", line 390, in run
result = self._run(*self.args, **self.kwargs)
File "/var/pyramid/maxserver/eggs/gevent_socketio-0.3.5_rc2-py2.7.egg/socketio/transports.py", line 230, in read_from_ws
message = websocket.receive()
File "/var/pyramid/maxserver/eggs/gevent_websocket-0.3.6-py2.7.egg/geventwebsocket/websocket.py", line 296, in receive
result = self._receive()
File "/var/pyramid/maxserver/eggs/gevent_websocket-0.3.6-py2.7.egg/geventwebsocket/websocket.py", line 244, in _receive
frame = self.receive_frame()
File "/var/pyramid/maxserver/eggs/gevent_websocket-0.3.6-py2.7.egg/geventwebsocket/websocket.py", line 177, in receive_frame
data0 = read(2)
File "/var/pyramid/maxserver/eggs/gevent_websocket-0.3.6-py2.7.egg/geventwebsocket/python_fixes.py", line 22, in readinto
return self._sock.recv_into(b)
File "/var/pyramid/maxserver/eggs/gevent-0.13.8-py2.7-linux-i686.egg/gevent/socket.py", line 472, in recv_into
wait_read(sock.fileno(), timeout=self.timeout, event=self._read_event)
File "/var/pyramid/maxserver/eggs/gevent-0.13.8-py2.7-linux-i686.egg/gevent/socket.py", line 169, in wait_read
switch_result = get_hub().switch()
File "/var/pyramid/maxserver/eggs/gevent-0.13.8-py2.7-linux-i686.egg/gevent/hub.py", line 164, in switch
return greenlet.switch(self)
timeout: timed out
<Greenlet at 0xa46157c: read_from_ws> failed with timeout
I've checked all python packages versions and there are identical in both computers. Also upgraded production computer to libevent 1.4.14b to match local computer.
I don't know which way to go to debug this. Help appreciated!

Categories