Background: I'm trying to write a Python script that creates a task in ToDoist using their REST API Python SDK, based on the charge percentage of my dog's Fi Collar (obtained via Pytryfi). Basically, if the Fi collar's battery falls below a certain threshold, create a new task.
Problem: A 401 error is returned when trying to use the todoist_api_python SDK, copied exactly from Todoist's website.
Following these instructions, I was able to install todoist-api-python, but when I run this code (using a real API key):
pip install todoist-api-python
from todoist_api_python.api import TodoistAPI
api = TodoistAPI("XXXXXXX")
try:
projects = api.get_projects()
print(projects)
except Exception as error:
print(error)
I receive this error:
410 Client Error: Gone for url: https://api.todoist.com/rest/v1/projects
I do know there has been a recent change from v1->v2 of this API, and indeed when I put the URL above from the error message in to a browser with ../v2/projects, I see a list of my tasks.
I don't know how to make the todoist-api-python SDK point to the new URL. I'd really appreciate any help you can offer! Thanks!
Be sure you're using the version 2 of todoist-api-python, as this is the one that uses the latest version of the API: https://pypi.org/project/todoist-api-python/
You're probably using an old version that relies on REST API v1.
Related
I have a django application app in which there is a model booking and the idea is that when someone books
the model calculates some metrics
generates a plotly figure and exports it statically
it sends a message to the respective user via email.
Before the email had plain text. In order to test the new changes. Ive done something of this sort.
def send_notification(self):
try:
mail_msg = new_email()
mail_msg.send()
except Exception as e:
logger.error(f"failed to send new booking mail due to {e}"
mail_msg = old_mail()
mail_msg.send()
Working, and debugging locally had no issues with using kaleido as the export engine when attaching the image to new_mail, namely.
fig.to_image("png", engine="kaleido")
Pipeline is as follows, FE book -> SQS -> send_notification()
On AWS I did not get any errors when the new code was deployed, and I also did not get any mails, not the new ones, not the old ones. After 1 hour, the 10 attempts that I've made powered through, both in email and in the logs naturally. But I just got the old emails, as I expected.
Logs show
Error initializing NSS with a persistent database (sql:/home/webapp/.pki/nssdb): /lib64/libm.so.6: version `GLIBC_2.29' not found (required by /var/app/venv/staging-LQM1lest/lib/python3.8/site-packages/kaleido/executable/lib/libsqlite3.so.0)
[ERROR] failed to send new booking mail due to 'Transform failed. Error stream'
I understand that upgrading glibc standalone can break your system quite easily. I am going to try downgrading kaleido.
Is there other thing I could try to solve this? All the options I can think of are
downgrading kaleido (it would be amazing to check which version of glibc they require first)
creating a lambda just to fig.to_image()
I have been trying to run a python script to get Nao's audio as a stream
Found the example directly on aldebaran's website
http://doc.aldebaran.com/2-8/dev/python/examples/audio/audio_soundprocessing.html#process-microphone-signals
I am trying to run it as is with only my robot's proper IP. Once it gets to the startProcessing function, it cannot find the new service created in ALAudioDevice and gives the following error
self.audio_service.setClientPreferences(self.module_name, 16000, 3, 0)
RUNTIMEERROR: ALPROXY::ALPROXY
CANT FIND SERVICE: SoundProcessingModule
[W] 1609782681.228570 42712 QITYPE.SIGNAL: DISCONNECT: NO SUBSCRIPTION FOUND FOR SIGNALLINK 14.
Any idea of what should change to be able to run that example?
As you can see in the link you provided, prior to setting the audio client preferences, you must register your service (or "module") to NAOqi:
app.session.listen()
app.session.registerService("SoundProcessingModule", MySoundProcessingModule)
It is important that your service is registered prior to referring to it in other APIs such as setClientPreferences.
I want to use python API to create a User and project, assign that user to the project created and then allocate certain quota. I can't find documentation for this. What is the best way to do these tasks using code (cant do it with CLI).
Thanks.
Error : 'Proxy' object has no attribute 'v2'
Code:
from openstack import connection
import openstack
conn = connection.Connection(auth_url="https://example.com/v2.0",
project_name="admin",
username="admin",
password="test", verify=False)
conn.identity.v2._proxy.create_role()
Documentation URL : https://developer.openstack.org/sdks/python/openstacksdk/users/proxies/identity_v2.html
I have not tried openstack user/domain/project creation using python directly. But the openstack cli in turn uses the python APIs only.
The CLI command actually imports the python module 'openstackclient'.
So digging further into this may help you.
The default location where openstack client installed is
/usr/lib/python2.7/dist-packages/openstackclient/
I've just run gcloud components update and now cannot create a view or table via the bq Python command-line tool.
It returns an error Unexpected exception in mk operation: '_Make' object has no attribute 'partitioning_specification'.
How to deal with this?
The fix is now live. You can run gcloud components update to pick up the latest client.
There was a bug in the "bq" tool that was pushed in the most recent build.
We are working on adding some additional testing to catch this type of error.
In the meantime, please do a gcloud components restore to restore your previous version of the Google Cloud SDK if you encounter this error and need to create a view or table.
I am trying to update Firebase using the python-firebase library, but cannot get authentication to work, using adapted sample code:
from firebase import firebase as fb
auth = fb.FirebaseAuthentication('<firebase secret>', 'me#gmail.com',
auth_payload={'uid': '<uid>'}) // NB renamed extras -> auth_payload, id -> uid here
firebase = fb.FirebaseApplication('https://<url>.firebaseio.com', authentication=auth)
result = firebase.get('/users', name=None, connection=None,
params={'print': 'pretty'}) // HTTPError: 401 Client Error: Unauthorized
print result
I keep getting (401) Unauthorized, but I notice that the token generated by the library is radically different to one generated by a JavaScript version of FirebaseTokenGenerator - and the latter authenticates fine when I provide the same URL, uid and secret.
I noticed a GitHub issue, questioning why the library did not just use the official Python firebase-token-generator, so I forked and implemented the suggested change just in case it would make a difference, but still get the same result.
Can anyone suggest what might be tripping me up here?
This library is 4 years old which means lots of things have been changed for firebase especially after Google's acquisition. The part of how you access Firebase is completely different.
I will recommend to use the official Firebase Admin Python SDK https://github.com/firebase/firebase-admin-python
A really good alternative but prefer the official is this:
https://github.com/thisbejim/Pyrebase