AttributeError: 'coroutine' object has no attribute 'chats' - telethon

Stopped working on telethon v2 how can I fix this?
chat_list = self.client(_tl.fn.contacts.Search(q=key, limit=100)).chats

try;
_chat_list = await self.client(_tl.fn.contacts.Search(q=key, limit=100))
chat_list = _chat_list.chats

Related

Kreait : verifySessionCookie() not found

I try to verify a session cookie from the $sessionCookieString = $auth->createSessionCookie($idToken, $oneWeek); which work normally.
But report say that the function is not found.
"Call to undefined method Kreait\Firebase\Auth::verifySessionCookie()"
Didn't understand why.
i have the latest version install.
--- Portion of code below ---
use Kreait\Firebase\Factory;
use Kreait\Firebase\Contract\Auth;
use Kreait\Firebase\Auth\UserQuery;
use Google\Cloud\Firestore\FirestoreClient;
use Kreait\Firebase\Auth\CreateSessionCookie\FailedToCreateSessionCookie;
public function doLogin() {
$factory = (new Factory)->withServiceAccount($this->ekonysJson );
$auth = $factory->createAuth();
$this->auth = $auth;
//print_r($auth);
$signInResult = $auth->signInWithEmailAndPassword("email#dot", "password");
$idToken = $signInResult->idToken();
`print_r($signInResult->refreshToken());`
$oneWeek = new \DateInterval('P7D');
$sessionCookieString = $auth->createSessionCookie($idToken, $oneWeek);
$verifiedSessionCookie = $auth->verifySessionCookie($sessionCookieString)
}
refer to doc https://firebase-php.readthedocs.io/en/stable/authentication.html#session-cookies
if you have any idea.... thanks
Solution for this problem

object has no attribute 'visible_device_list'

I'm trying to extract faces from pics but in some where I hit this error:
my code:
config = tf.compat.v1.ConfigProto #tf.ConfigProto()
config.gpu_options.visible_device_list ='0'
and the error I get:
AttributeError: 'google.protobuf.pyext._message.FieldProperty' object has no attribute 'visible_device_list'
If there is help, I will be thankful.
just need to add two parentheses!
config = tf.compat.v1.ConfigProto()

Getting an invalid token on an interpolated string sent from python/jinga2 backend

I'm sending a variable called apiID from a tornado/jinja2 python file to my vuejs template like this:
class SmartAPIUIHandler(BaseHandler):
def get(self, yourApiID):
doc_file = "smartapi-ui.html"
dashboard_template = templateEnv.get_template(doc_file)
dashboard_output = dashboard_template.render(apiID = yourApiID )
self.write(dashboard_output)
then in vuejs I'm interpolating the variable with no problem except it gives me an error
it says: Uncaught SyntaxError: Invalid or unexpected token
I checked on the python handler file and apipID is a string, so I don't see the problem. I'm quite new to python so maybe the answer is more obvious to one of you. I appreciate the help!!
Because of dashboard_output = dashboard_template.render(apiID = yourApiID ), you must have, in your template, something around the code:
this.apiID = {{ apiID }};
Due to the value being not a number but a string, add the 's:
this.apiID = '{{ apiID }}';

Invalid Runame In eapy api in getiing session

I am trying to get the ebay session id from ebay python sdk. When i make request to the api. I am getting the error invalid ru_name. I have cross checked with name. It's correct.
This is my GetSession python code, Works good for me.
from ebaysdk.exception import ConnectionError
from ebaysdk.trading import Connection as Trading
myRuName = "XXXXXXXXXXXXMyRuNameXXXXXXXXXXXXXXXXXX"
myAppID = "XXXXXXXXXXXXXMyAppIDXXXXXXXXXXXXXXXXXXX"
myDevID = "XXXXXXXXXXXXXMyDevIDXXXXXXXXXXXXXXXXXX"
myCertID = "XXXXXXXXXXXXXXMyCertIDXXXXXXXXXXXXXXXX"
myFlags = {'RuName': myRuName}
try:
api = Trading(config_file=None, appid=myAppID, devid=myDevID, certid=myCertID)
response = api.execute('GetSessionID',myFlags)
print 'SessionID = '+response.reply.SessionID
except ConnectionError as e:
print(e)
print(e.response.dict())
Hope this helps.

AssertionError: relay-101/index.js: getBabelRelayPlugin(): Expected schema to be an object with a `__schema`

I was following Relay 101: Building A Hacker News Client Tutorial.
But in the process I got error
AssertionError: relay-101/index.js: getBabelRelayPlugin():
Expected schema to be an object with a `__schema` property.
at getSchema (/Users/ruseel/p/spike/relay-101/node_modules/babel-relay-plugin/src/getBabelRelayPlugin.js:224:3)
at NodePath.Plugin.visitor.TaggedTemplateExpression (/Users/ruseel/p/spike/relay-101/node_modules/babel-relay-plugin/src/getBabelRelayPlugin.js:104:26)
...
and after little digging (console.log in getBabelRelayPlugin.js) I noticed introspection var in getBabelRelayPlugin.js
const introspection = typeof schemaProvider === 'function' ?
schemaProvider() :
schemaProvider;
is like this.
{"errors":[{"message":"Must provide query string."}]}
But I have no idea why this is happening?
Why is this error happening?
any direction would be appreciated.
I made a typo in babelRelayPlugin.js, instrospectionQuery instead of introspectionQuery.
var babelRelayPlugin = require('babel-relay-plugin');
var introspectionQuery = require('graphql/utilities').introspectionQuery;
var request = require('sync-request');
var graphqlHubUrl = 'http://www.graphqlhub.com/graphql';
var response = request('GET', graphqlHubUrl, {
qs: {
query: introspectionQuery
}
});