Using Version: 0.117.0 of instabot.
Already being logged in I run:
from instabot import Bot
insta = Bot()
insta.upload_photo(photo_path,caption ="just try")
This is what I get:
2021-02-11 00:38:56,519 - INFO - Instabot version: 0.117.0 Started
FOUND: w:1024 h:1024 r:1.0
Traceback (most recent call last):
File "main.py", line 43, in <module>
insta.upload_photo(photo_path,caption ="just try")
File "/Users/user/.virtualenvs/v3/lib/python3.8/site-packages/instabot/bot/bot.py", line 806, in upload_photo
return upload_photo(self, photo, caption, upload_id, from_video, options)
File "/Users/user/.virtualenvs/v3/lib/python3.8/site-packages/instabot/bot/bot_photo.py", line 26, in upload_photo
result = self.api.upload_photo(
File "/Users/user/.virtualenvs/v3/lib/python3.8/site-packages/instabot/api/api.py", line 825, in upload_photo
return upload_photo(
File "/Users/user/.virtualenvs/v3/lib/python3.8/site-packages/instabot/api/api_photo.py", line 154, in upload_photo
self.session.headers.update(
AttributeError: 'API' object has no attribute 'session'
you can specify use_cookie parameter as False in login() method which means that bot would use cookies not to re-login every time it needs to push some request. Defaults as True.
bot.login(username="",password="",use_cookie=False)
I already ran login before and it is supposed to store the credentials. When I reran login it always gave me:
2021-02-11 07:20:42,052 - INFO - Instabot version: 0.117.0 Started
Traceback (most recent call last):
File "main.py", line 42, in <module>
insta.login(username=username,password=password)
File "/Users/user/.virtualenvs/v3/lib/python3.8/site-packages/instabot/bot/bot.py", line 443, in login
if self.api.login(**args) is False:
File "/Users/user/.virtualenvs/v3/lib/python3.8/site-packages/instabot/api/api.py", line 240, in login
self.load_uuid_and_cookie(load_cookie=use_cookie, load_uuid=use_uuid)
File "/Users/user/.virtualenvs/v3/lib/python3.8/site-packages/instabot/api/api.py", line 199, in load_uuid_and_cookie
return load_uuid_and_cookie(self, load_uuid=load_uuid, load_cookie=load_cookie)
File "/Users/user/.virtualenvs/v3/lib/python3.8/site-packages/instabot/api/api_login.py", line 354, in load_uuid_and_cookie
self.cookie_dict["urlgen"]
KeyError: 'urlgen'
Which I thought was the feedback when you are already being logged in. I am still not sure why my first login seemed to fail. And why it doesn't give a proper feedback.
After dezese's answer I started doubting that the login was successful and I found this
I just ended up running:
rm -rf config
And then the code properly with login:
insta = Bot()
insta.login(username=username,password=password)
insta.upload_photo(photo_path,caption ="just try")
And everything worked! Thanks deceze for pointing me in the right direction. I hope this detailed explanation helps people with similar issues, since those error codes are not really helpful in finding the true cause.
Currently I have to delete the config folder every time. Not the best solution but works for now. If anybody knows a better way please post it and I will accept the answer
I solved it by just deleting the uuid_and_cookie.json before bot.login()
import os
try:
os.remove("config/<your_username>_uuid_and_cookie.json")
except:
pass
There's a bug when the file exists
Related
I'v been trying to launch project(example_setup folder):
https://github.com/OTA-Insight/djangosaml2idp/tree/master/example_setup
I can anybody answer to men according with documentation. But it does not working. First problem, as I undesrtand is in date of methadata in SP(idp_metadata.xml)- validUntil="2020-12-27T12:41:18Z"> . It does not valid at the moment, and was changed to future date, as example(validUntil="2030-12-27T12:41:18Z"). But next I got another problem when trying to sign in to SP(localhost:8000) in my browser, I have more problem:
Error during SAML2 authentication
IncorrectlySigned
In attempts to find problem, I found the place where it is occured. In original it iis in tryexcept block, and can't be found easy.
Traceback (most recent call last):
File "/home/dmitriy/projects/djangosaml2idp/example_setup/idp/djangosaml2idp/views.py", line 251, in get
req_info = idp_server.parse_authn_request(request.session['SAMLRequest'], binding)
File "/home/dmitriy/projects/djangosaml2idp/example_setup/idp/venv/lib/python3.8/site-packages/saml2/server.py", line 238, in parse_authn_request
return self._parse_request(enc_request, AuthnRequest,
File "/home/dmitriy/projects/djangosaml2idp/example_setup/idp/venv/lib/python3.8/site-packages/saml2/entity.py", line 1036, in _parse_request
_request = _request.loads(xmlstr, binding, origdoc=enc_request,
File "/home/dmitriy/projects/djangosaml2idp/example_setup/idp/venv/lib/python3.8/site-packages/saml2/request.py", line 110, in loads
return self._loads(xmldata, binding, origdoc, must,
File "/home/dmitriy/projects/djangosaml2idp/example_setup/idp/venv/lib/python3.8/site-packages/saml2/request.py", line 51, in _loads
print(self.signature_check(xmldata, origdoc=origdoc,
File "/home/dmitriy/projects/djangosaml2idp/example_setup/idp/venv/lib/python3.8/site-packages/saml2/sigver.py", line 1662, in correctly_signed_authn_request
return self.correctly_signed_message(decoded_xml, 'authn_request', must, origdoc, only_valid_cert=only_valid_cert)
File "/home/dmitriy/projects/djangosaml2idp/example_setup/idp/venv/lib/python3.8/site-packages/saml2/sigver.py", line 1653, in correctly_signed_message
return self._check_signature(
File "/home/dmitriy/projects/djangosaml2idp/example_setup/idp/venv/lib/python3.8/site-packages/saml2/sigver.py", line 1503, in _check_signature
raise MissingKey(_issuer)
saml2.sigver.MissingKey: http://localhost:8000/saml2/metadata/
Internal Server Error: /idp/login/process/
Some key is missing:
Error during SAML2 authentication
MissingKey
http://localhost:8000/saml2/metadata/
My idp_metada in the SP is like in the [example_setup][1] folder of project, only validUntil has been changed as I said above, user in IDP has been created as superuser, I also tried to create user in the SP, the same as in the IDP, but nothing changed
Can anybody anser to me, what my problem is?
It's no any information in docs. But you need to create SP inside IDP from admin panel. That was resolved my problem.
With the following code that I have for my bot, he's not booting up. I don't understand.
Here is my code (I have put a mystb.in link, because my question had "too much code")
The full traceback:
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x0000000004005D30>
Traceback (most recent call last):
File "C:\Users\Bi\AppData\Local\Programs\Python\Python38\lib\asyncio\proactor_events.py", line 116, in __del__
self.close()
File "C:\Users\Bi\AppData\Local\Programs\Python\Python38\lib\asyncio\proactor_events.py", line 108, in close
self._loop.call_soon(self._call_connection_lost, None)
File "C:\Users\Bi\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 711, in call_soon
self._check_closed()
File "C:\Users\Bi\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 504, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
And here is the image of what the error shows up like in VSCode.
There is something that I don't understand very well, when I put in a different token it works just perfectly fine.
It seems to me that the problem lies in reading from the config file in main at lines 6-13. Make sure that in config.json you have all the variables you're trying to get and it gets them correctly.
In fact, I went on replit and the error shew very well : Invalid token.
My bot just got deleted.
I have Asterisk 13.20 set up and running fine on Ubuntu 16.04,calls are going well through a Softphone(Zoiper), I came across a Library in Python "Pycall" which lets you make calls through a Python Script.So I tried testing a snippet from the site Pycall
The code that I used:
from pycall import CallFile, Call, Application
call = Call('SIP/flowroute/18882223333')
action = Application('Playback', 'hello-world')
c = CallFile(call, action)
c.spool()
Just made changes in the extension,wherein I used one from my server
However I am getting the following error:
Traceback (most recent call last):
File "test.py", line 10, in <module>
c.spool()
File "/usr/local/lib/python2.7/dist-packages/pycall/callfile.py", line 131, in spool
self.writefile()
File "/usr/local/lib/python2.7/dist-packages/pycall/callfile.py", line 119, in writefile
f.write(self.contents)
File "/usr/local/lib/python2.7/dist-packages/pycall/callfile.py", line 114, in contents
return '\n'.join(self.buildfile())
File "/usr/local/lib/python2.7/dist-packages/pycall/callfile.py", line 96, in buildfile
raise ValidationError
pycall.errors.ValidationError
Tried searching online for the solution but coudnt find one,What am I doing wrong?
This question not related to PBX, it is just incorrect use of LIB.
General instruction how to solve ANY issue with availible source code.
You have error
File "/usr/local/lib/python2.7/dist-packages/pycall/callfile.py", line 96, in buildfile
Go that file and line, check code, add more debug if needed, fix your app.
Run as asterisk user.
sudo su asterisk -s /bin/bash
python
from pycall import CallFile, Call, Application
call = Call('SIP/flowroute/18882223333')
action = Application('Playback', 'hello-world')
c = CallFile(call, action)
c.spool()
I am using python selenium webdriver in our framework , of late we have been seeing errors like below
(<type 'exceptions.AttributeError'>,
AttributeError("'unicode' object has no attribute 'text'",)
,<traceback object at 0x00000000037D8D48>)
And also we are seeing this error in our product which has unicode charecters in them.Doesnt happen always happens once in 15 times.
Stacktrace:
self.compare_units_test('Singapore')
line 391, in compare_units_test
self.assertTrue(home_page.is_loaded(), Errors.HOMEPAGE_LOGO_ERROR)
File "", line 32, in is_loaded
"Logo did not load results in 10 seconds")
File "\venv\lib\site-packages\pscore\core\support\ps_wait.py", line 20,in until_visible
self._wait_until_visible(locator, timeout, message, True)
File "venv\lib\site-packages\pscore\core\support\ps_wait.py", line 15, in _wait_until_visible
wait.until(EC.visibility_of_element_located(locator), message=message)
File "\venv\lib\site-packages\selenium\webdriver\support\wait.py", line 66, in until
value = method(self._driver)
File "\venv\lib\site- packages\selenium\webdriver\support\expected_conditions.py", line 72, in __call__
return _element_if_visible(_find_element(driver, self.locator))
File \venv\lib\site- packages\selenium\webdriver\support\expected_conditions.py", line 90, in _element_if_visible
return element if element.is_displayed() else False
AttributeError: 'unicode' object has no attribute 'is_displayed'
2015-09-10 15:56:36 - INFO wd_testcase.py:111 in run : Test Runner: Tearing down test: test_compare_units (tests.test.TestFlightsSearch)
2015-09-10 15:56:36 - INFO wd_testcase.py:48 in tearDown : Test Runner: Attempting to teardown.
2015-09-10 15:56:36 - ERROR wd_testcase.py:125 in run : Traceback (most recent call last):
File \venv\lib\site-packages\pscore\core\wd_testcase.py", line 112, in run
self.tearDown()
File "\venv\lib\site-packages\pscore\core\wd_testcase.py", line 49, in tearDown
WebDriverFinalizer.finalize(self.driver, self.has_failed(), self.logger, self.test_context)
File "\venv\lib\site-packages\pscore\core\finalizers.py", line 28, in finalize
WebDriverFinalizer.finalize_skygrid(driver, test_failed, test_context) File "\lib\site-packages\pscore\core\finalizers.py", line 152, in finalize_skygrid
WebDriverFinalizer.finalise_skygrid_driver_failure(driver, test_context)
File "\venv\lib\site-packages\pscore\core\finalizers.py", line 168, in finalise_skygrid_driver_failure
final_url = driver.current_url
File "venv\lib\site- packages\selenium\webdriver\support\event_firing_webdriver.py", line 201, in __getattr__
raise AttributeError(name)AttributeError: current_url
We are using 2.45 version of selenium and 2.7.7 version of python.
When i dug into webdriver source code found this
try:
str = basestring
except NameError:
pass
which specifically addresses the unicode problem which webdriver was running into.
Any ideas what might be causing this? Help would be greatly appreciated
Found the root cause of the problem, it looked like one of the tests was spawning a new browser window and the subsequent tests were using the dialog window instead of the browser window to do selenium commands. At some point one of the tests performed a driver.quit and when the subsequent tests tried to access driver.something they failed since driver was already killed.
I'm testing ebaysdk Python library that lets you connect to ebay. Now I'm trying examples from: https://github.com/timotheus/ebaysdk-python/
So far I got stuck at this example:
from ebaysdk.shopping import Connection as Shopping
shopping = Shopping(domain="svcs.sandbox.ebay.com", config_file="ebay.yaml")
response = shopping.execute('FindPopularItems',
{'QueryKeywords': 'Python'})
print response.disct()
When I run it. It gives me this error:
Traceback (most recent call last):
File "ebay-test.py", line 13, in <module>
{'QueryKeywords': 'Python'})
File "/usr/local/lib/python2.7/dist-packages/ebaysdk-2.1.0-py2.7.egg/ebaysdk/connection.py", line 123, in execute
self.error_check()
File "/usr/local/lib/python2.7/dist-packages/ebaysdk-2.1.0-py2.7.egg/ebaysdk/connection.py", line 193, in error_check
estr = self.error()
File "/usr/local/lib/python2.7/dist-packages/ebaysdk-2.1.0-py2.7.egg/ebaysdk/connection.py", line 305, in error
error_array.extend(self._get_resp_body_errors())
File "/usr/local/lib/python2.7/dist-packages/ebaysdk-2.1.0-py2.7.egg/ebaysdk/shopping/__init__.py", line 188, in _get_resp_body_errors
dom = self.response.dom()
File "/usr/local/lib/python2.7/dist-packages/ebaysdk-2.1.0-py2.7.egg/ebaysdk/response.py", line 229, in dom
return self._dom
File "/usr/local/lib/python2.7/dist-packages/ebaysdk-2.1.0-py2.7.egg/ebaysdk/response.py", line 216, in __getattr__
return getattr(self._obj, name)
AttributeError: 'Response' object has no attribute '_dom'
Am I missing something here or it could be some kind of bug in library?
Do you have a config file? I had a lot of problems getting started with this SDK. To get the yaml config file to work, I had to specify the directory that it was in. So in your example, it would be:
shopping = Shopping(domain="svcs.sandbox.ebay.com", config_file=os.path.join(os.path.dirname(os.path.realpath(__file__)), 'ebay.yaml'))
You should also be able to specify debug=true in your Shopping() declaration as in Shopping(debug=True).
Make sure if you have not, to specify your APP_ID and other necessary values in the config file.
You have the wrong domain, it should be open.api.sandbox.ebay.com. See this page on the ebaysdk github.