Eventbrite API throws InternetConnectionException - eventbrite

The following code works fine from my own machine but when ran from a server in the Microsoft Azure cloud it throws an exception. This used to work fine last time I checked (a couple weeks back). In both cases I'm using eventbrite==3.0.2 from pip (other versions exhibit similar behavior)
$ python
Python 2.7.9 (default, Apr 24 2015, 22:50:46)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import eventbrite
>>> oauth_token = 'MY_TOKEN'
>>> eventbrite = eventbrite.Eventbrite(oauth_token)
>>> data = dict(city='San Francisco', since_id=16991295422)
>>> num_events = eventbrite.get('/events/search', data=data)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/eventbrite/decorators.py", line 20, in wrapper
raise InternetConnectionError(e)
eventbrite.exceptions.InternetConnectionError: ('Connection aborted.', ResponseNotReady())
I know there is a redirect involved here, would that be cause?

This has nothing to do with Azure. I provisioned another server and it worked fine. So it is probably the eventbrite API blocking that IP in particular. Can't confirm that though until eventbrite API folks respond to the email I sent them :)

Related

Trouble with minimqtt and CircuitPython

I have been unable to connect to io.adafruit by mqtt, and I wonder if it is the minimqtt library. I am using the stock example code on github.
Example code: here
Board: Adafruit Esp32-S2 Feather
Firmware: CircuitPython 7.3.2
Secrets File:
secrets = {
'ssid' : '[deleted]',
'password' : '[deleted]',
'aio_username' : '[deleted]',
'aio_key' : '[deleted]',
'timezone' : "America/New_York", # http://worldtimeapi.org/timezones
'broker' : 'io.adafruit.com',
'port' : 1883
}
Output:
Connecting to [home network]
Connected to [home network]!
Attempting to connect to io.adafruit.com
Traceback (most recent call last):
File "code.py", line 97, in
File "adafruit_minimqtt/adafruit_minimqtt.py", line 441, in connect
File "adafruit_minimqtt/adafruit_minimqtt.py", line 254, in _get_connect_socket
TypeError: extra positional arguments given
I was having similar errors using the Unexpected Maker ESP32-S2 as well.
Possibly related github issues? #3836, #4394

Django Channels / Daphne Internal Server Error: 'module' object is not callable

I'm trying to install a production server for Django Channels application I've been running locally with success. However, when starting Daphne and reaching to the application via browser, I get an Internal Server Error from Daphne. Console output is as follows:
2021-08-07 11:57:09,584 DEBUG HTTP b'GET' request for ['127.0.0.1', 33566]
2021-08-07 11:57:10,071 ERROR Exception inside application: 'module' object is not callable
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/asgiref/compatibility.py", line 34, in new_application
instance = application(scope)
TypeError: 'module' object is not callable
2021-08-07 11:57:10,072 DEBUG HTTP 500 response started for ['127.0.0.1', 33566]
As the project/asgi.py might have some relevance here, it is below:
import os
import django
from django.core.asgi import get_asgi_application
os.environ['DJANGO_SETTINGS_MODULE'] = "proj.settings"
django.setup()
from channels.auth import AuthMiddlewareStack
from channels.routing import ProtocolTypeRouter, URLRouter
import app.routing
application = ProtocolTypeRouter({
"http": get_asgi_application(),
"websocket": AuthMiddlewareStack(
URLRouter(
app.routing.websocket_urlpatterns
)
),
})
However, I've been poking around with the said asgi.py, and I have a feeling that at least the application variable does not have anything to do with this, as that block could be commented out with no impact on the error message.
Relevant packages:
channels 3.0.4
daphne 3.0.2
Django 3.2.6
Any ideas?

Coral Dev Board Windows 10 setup

I followed the windows host instructions described in the https://coral.ai/docs/dev-board/get-started/
When I run command mdt devices, I get following exception always:
$ mdt devices
Traceback (most recent call last):
File "c:\users\ram\anaconda3\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\ram\anaconda3\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\Ram\AppData\Roaming\Python\Python38\Scripts\mdt.exe\__main__.py", line 7, in
<module>
File "C:\Users\Ram\AppData\Roaming\Python\Python38\site-packages\mdt\main.py", line 162, in
main
exit(command.run(sys.argv[1:]))
File "C:\Users\Ram\AppData\Roaming\Python\Python38\site-packages\mdt\devices.py", line 43, i
n run
self.discoverer.discover()
File "C:\Users\Ram\AppData\Roaming\Python\Python38\site-packages\mdt\discoverer.py", line 40
, in discover
self.zeroconf = Zeroconf()
File "C:\Users\Ram\AppData\Roaming\Python\Python38\site-packages\zeroconf\__init__.py", line
2508, in __init__
self._listen_socket, self._respond_sockets = create_sockets(
File "C:\Users\Ram\AppData\Roaming\Python\Python38\site-packages\zeroconf\__init__.py", line
2343, in create_sockets
respond_socket = new_respond_socket(i, apple_p2p=apple_p2p)
File "C:\Users\Ram\AppData\Roaming\Python\Python38\site-packages\zeroconf\__init__.py", line
2302, in new_respond_socket
respond_socket = new_socket(
File "C:\Users\Ram\AppData\Roaming\Python\Python38\site-packages\zeroconf\__init__.py", line
2250, in new_socket
s.bind((bind_addr[0], port, *bind_addr[1:]))
OSError: [WinError 10049] The requested address is not valid in its context
Versions of my set up:
$ python --version
Python 3.8.5
$ mdt version
MDT version 1.5.2
Can you please help me to resolve this issue?
The same happened to me. Skipping some IP addresses solved the issue. Try this code:
import logging
import zeroconf
import ifaddr
for adapter in ifaddr.get_adapters():
print("IPs of network adapter ", adapter.nice_name)
for ip in adapter.ips:
print(" %s/%s", ip.ip, ip.network_prefix)
logging.basicConfig(level=logging.DEBUG)
logging.getLogger("zeroconf").setLevel(level=logging.DEBUG)
z = zeroconf.Zeroconf()
From the log, find
INFO:zeroconf:Address not available when adding XXX.XXX.XX.XX to multicast group, it is expected to happen on some systems
Along with the Zeroconf log, there should be a list of ip addresses and names. Please find the name of the hardware that is causing the problem.
Now, open zeroconf/__init__.py and goto get_all_addresses() and replace the code with below
adapters = [x for x in ifaddr.get_adapters()
if not "Microsoft Wi-Fi Direct Virtual Adapter" in x.nice_name
and not "Bluetooth Device" in x.nice_name]
return list(set(addr.ip for iface in adapters for addr in iface.ips if addr.is_IPv4))
Please replace the "Microsoft Wi-Fi Direct Virtual Adapter" and "Bluetooth Device" with the appropriate name.
This is not a neat way, so I'd be open to better answers.

No module named 'twilio'

I am trying to use twilio to send a text message...when I put the demo script in a texteditor, ave it as something.py and run it from terminal, I receive the text message.
However, when I copy and paste the same code into Spyder (Anaconda 3 environment, Python 3.8) I get the following error.
Here is the code:
from twilio.rest import Client
account_sid = 'xxx'
auth_token = 'xxx'
client = Client(account_sid, auth_token)
message = client.messages \
.create(
body="Test.",
from_='x',
to='xxx'
)
print(message.sid)
And here is there error:
File "xxx", line 14, in <module>
import twilio
ModuleNotFoundError: No module named 'twilio'
I have installed with pip, pip3, Conda, all that.
I'm not really used to this anaconda environment thing, but when I search for the package "twilio" the only thing that shows up is r-Twilio. I imagine this is something to do with the problem, but I've no idea. I tried creating a new environment with python 2.7 and again only saw the r-twilio thing.

Yandex-tank not working

Good day.
When I trying to run yandex-tank test, i recieve next text in console:
Traceback (most recent call last):
File "/usr/bin/yandex-tank", line 5, in
from pkg_resources import load_entry_point
ImportError: No module named pkg_resources
Yandex-tank installed on vagrant VM Ubuntu 12.04 LTS
load.ini-file
[phantom]
address=http://*host_mane*.com/articles/get_article
rps_schedule=line(1,100,1m)
ammo_type=phantom
Request-file
238
POST http://*host_name*.com/articles/get_article HTTP/1.1
Host: *host_name*.com
Content-Type: application/json
Content-Length: 88
{
"url": "blah-blah-blah.com"
}
Starting tank in console with yandex-tank post.txt
What I doing wrong?
it seems as a problem with broken setuptools installation. Have you checked No module named pkg_resources?

Resources