Comments (9)
Thank you for reporting. I didn't know inspect.getsource
can't work in interactive mode. I guess you can run if you save readme script on files. Could you try that?
#31 is not perfect solution, just telling people more friendly that you can't use this in interactive mode.
from pythonista-chromeless.
Thanks for your help. that error is gone.
However, the script is still not running. I am getting another error:
Function not found: arn:aws:lambda:us-west-2:<aws account id>:function:chromeless-server-prod
You can see the region its referring is us-west-2
, but the command I ran was sls deploy --region us-east-2
. Is there anything I am missing? Any env or updates in serverless.yml
?
from pythonista-chromeless.
My bad, there was another npm package named sls
, which was doing trouble.
Uninstalled it.
Thanks again.
from pythonista-chromeless.
Lambda deployed successfully, but still getting same error:
arn:aws:lambda:us-west-2:<aws account id>:function:chromeless-server-prod
How do i tell Chromeless to target my region us-east-2
?
from pythonista-chromeless.
@faizanalhassan
I'm glad to hear that the former problems are gone.
What output will you get if you execute aws configure get region
in shell?
First, you need to deploy by sls deploy --region us-east-2
.
Second, setting environmental variable works like AWS_DEFAULT_REGION=us-west-2 python main.py
Or, hard-coding in script is also possible like below.
from chromeless import Chromeless
import boto3 # This
boto3.setup_default_session(region_name='us-east-2') # This
def get_title(self, url):
self.get(url)
return self.title
chrome = Chromeless()
chrome.attach(get_title)
print(chrome.get_title("https://example.com"))
If you don't mind setting us-east-2
as your default region so far, I'd recommend aws configure set region us-east-2
and above modifications are probably not necessary, but deployment.
from pythonista-chromeless.
Yeah, actually I have multiple AWS profiles, so that might be causing this. I also set region_name
in boto3, but the env way you shared is better AWS_DEFAULT_REGION
, so will try that.
As always again thanks.
from pythonista-chromeless.
However, I suggest to accept aws key, secret and region in Chromeless.__init__
, with default None
, so the user can set through env, AWS local config, or explicitly pass to the constructor like in boto3. If you agree with this suggestion, I can do these updates and create a PR.
from pythonista-chromeless.
Yes, I agree with your idea and PR is always welcome, thank you!
Instead of accepting credentials directly, I think __init__
should accept 'session', then session can take care of credentials or profile
from boto3.session import Session
session = Session(aws_access_key_id='<YOUR ACCESS KEY ID>',
aws_secret_access_key='<YOUR SECRET KEY>',
region_name='<REGION NAME>')
# or
session = Session(profile_name='<YOUR_PROFILE_NAME>')
from pythonista-chromeless.
Ok doing with session object. Will update you in a day or two. Thanks for accepting my contributions.
from pythonista-chromeless.
Related Issues (19)
- it should be able to hundle multiple methods in one instance HOT 1
- it is not clear what options is required inside of chrome_options
- Response payload size (9706999 bytes) exceeded maximum allowed payload size (6291556 bytes). Function.ResponseSizeTooLarge
- Can't install PIL on lambda. HOT 1
- Exception when apiurl and apikey are invalid
- pythonista-chromeless is released! HOT 4
- binascii.Error: Incorrect padding HOT 6
- Please don't provide ImageUri when updating a function with packageType Zip. HOT 1
- gateway api time out after 30 seconds HOT 2
- method 'save_screenshot' on client side is useful HOT 1
- Should accept region, credentials, and profiles HOT 3
- Chrome's default functions are not callable from chromeless so far
- WebDriverException: Chrome Not Reachable HOT 1
- screenshot fail to capture Japanese. HOT 2
- needs to handle error such as NoSuchElementException HOT 1
- NameError: name 'time' is not defined
- ChromeOptions option should be adjustable such as '--window-size' HOT 1
- UnboundLocalError: local variable 'screenshothandler' referenced before assignment│
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pythonista-chromeless.