i am trying to access google search console api - tried the sample [https://github.com/googleapis/google-api-python-client/blob/master/samples/searchconsole/search_analytics_api_sample.py][1]
i followed the instructions:
1) Install the Google Python client library, as shown at
https://developers.google.com/webmaster-tools/v3/libraries.
2) Sign up for a new project in the Google APIs console at
https://code.google.com/apis/console.
3) Register the project to use
OAuth2.0 for installed applications.
4) Copy your client ID, client
secret, and redirect URL into the client_secrets.json file included in
this package.
5) Run the app in the command-line as shown below.
Sample usage: $ python search_analytics_api_sample.py
'https://www.example.com/' '2015-05-01' '2015-05-30'
of course for my site and newer dates..
recieved in cmd the warning:
\AppData\Local\Programs\Python\Python38\lib\site-packages\oauth2client_helpers.py:255:
UserWarning: Cannot access webmasters.dat: No such file or directory
in the window opened in the browser got the message:
Error 400: redirect_uri_mismatch The redirect URI in the request,
http://localhost:8080/, does not match the ones authorized for the
OAuth client. To update the authorized redirect URIs, visit:
https://console.developers.google.com/apis/credentials/oauthclient/xxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com?project=xxxxxxxxxxxx
i configured the redirect URI as http://localhost:8080/ but still the same
appreciate any help thanks
Related
I’m trying to use NTLM plugin with cypress in order to handle windows authentication.
On navigating to my test url the test fails, returning the following error in the cypress test runner ui
‘Username contains invalid characters or is too long’
I’ve verified that my username is correct and can be used manually to access the url.
In my test I’m using the following code to launch the page:
it('should launch the home page with the correct user', () => {
cy.ntlm(['localhost:1234'] , 'XYX\\firstname.lastname', 'Password');
cy.visit('https://localhost:1234')
})
As a string, my username is 'XYX\firstname.lastname'
using this in the code treats the \ as an escape character hence the use of \
I’ve also tried using the url string in the format:
‘https://XYX\firstname.lastname:password#localhost:1234’
But this fails to launch the page
I suspect the problem is something to do to with the \ but im unsure on how to fix this.
Has anyone encountered the error ‘Username contains invalid characters or is too long’ when using ntlm and cypress and what did you do you resolve the issue?
I'm working on a project to automate google cloud setup, is there any way to create a google cloud platform project using Google-Api-Client for python?
Help me, please!
Thanks in advance!
Here's what I have tried:
From views.py
from google.cloud import resource_manager
...
client = resource_manager.Client()
# List down all gcp projects
for project in client.list_projects():
print(project)
new_project = client.new_project('project11-372', name='My new project')
new_project.create()
It list down all of my gcp projects but doesn't create new project.
Here's the error I have received:
File "/Users/abdul/Documents/IGui/rest/views.py", line 60, in post
new_project.create()
File "/Users/abdul/IstioVirEnv/lib/python3.6/site-packages/google/cloud/resource_manager/project.py", line 138, in create
data=data)
File "/Users/abdul/IstioVirEnv/lib/python3.6/site-packages/google/cloud/_http.py", line 293, in api_request
raise exceptions.from_http_response(response)
google.cloud.exceptions.Forbidden: 403 POST https://cloudresourcemanager.googleapis.com/v1beta1/projects: The caller does not have permission.
[20/Aug/2017 05:55:02] "POST /user/deployment/create/new HTTP/1.1" 500 14960
I have successfully created google cloud project by using Google cloud API python client.
Steps
run gcloud beta auth application-default login command to get application default credentials by login onto the browser
Enable Resource Manager API on my gcp console
Here's the working python code:
from googleapiclient import discovery
from oauth2client.client import GoogleCredentials
...
credentials = GoogleCredentials.get_application_default()
service = discovery.build('cloudresourcemanager', 'v1', credentials=credentials)
project_body = {
'name': 'Api Project',
'projectId': 'api-9837'
}
request = service.projects().create(body=project_body)
request.execute()
pprint(request)
I have a new computer and I'm trying to set up my AWS CLI environment so that I can run a management console I've created.
This is the code I'm running:
def create_bucket(bucket_args)
AWS_S3 = Aws::S3::Client.new(signature_version: 'v4')
AWS_S3.create_bucket(bucket_args)
end
Which raises this error:
Aws::S3::Errors::SignatureDoesNotMatch - The request signature we calculated does not match the signature you provided. Check your key and signing method.:
This was working properly on my other computer, which I no longer have access to. I remember debugging this same error on the other computer, and I thought I had resolved it by adding signature_version = s3v4 to my ~/.aws/config file. But this fix is not working on my new computer, and I'm not sure why.
To give some more context: I am using aws-sdk (2.5.5) and these aws cli specs: aws-cli/1.11.2 Python/2.7.12 Linux/4.4.0-38-generic botocore/1.4.60
In this case the issue was that my aws credentials (in ~/.aws/credentials) - specifically my secret token - were invalid.
The original had a slash in it:
xx/xxxxxxxxxxxxxxxxxxxxxxxxxx
which I didn't notice at first, so when I double clicked the token to select the word, it didn't include the first three characters. I then pasted this into the terminal when running aws configure.
To fix this, I found the correct, original secret acceess token and set the correct value in ~/.aws/credentials.
I am attempting to use a service account with Google's API to add a calendar event using php. I have this working perfectly on a site already. When i moved it to another site on the same server, i suddenly began to receive the following error messages:
~PHP Warning: mkdir(): Permission denied in Google/Cache/File.php
~Uncaught exception 'Google_Cache_Exception' with message 'Could not create storage directory: in Google/Cache/File.php
The two environments are identical as far as i can tell
~Same server
~Same permissions on all files/folders
~Same credentials
~Both URLS authorized in Google's console
I checked with my server to see if something in the upvoted answer here could be the issue, but was assured that everything was set up correctly.
I've done a lot of searching and reading, but can't imagine what might be causing these errors when everything works perfectly from the other site.
Any help would be much appreciated!
In case anyone comes upon this: I solved this by following the advise given here:
A client error occurred: Could not create storage directory: /tmp/Google_Client/00
specifically, i manually added nested folders (google and cache) inside my tmp directory and then set the path to it for google using this code (from the link above):
$config = new Google_Config();
$config->setClassConfig('Google_Cache_File', array('directory' => '../../tmp/google/cache'));
// Here I set a relative folder to avoid pb on permissions to a folder like /tmp that is not permitted on my mutualised host
$client = new Google_Client($config);
Add this PHP code to your script:
$client = new Google_Client();
$client->setCache(new Google_Cache_File('/path/to/shared/cache'));
In case also that anyone needs to do this. I'm working with Codeigniter and recently moved to osx el capitan on mac from windows 7. My google cache folder had the admin permissions read and write but the error persists: mkdir permission denied, on google/cache/file.php
I looked at my code where I load the google api and added>
$config = new Google_Config();
$config->setClassConfig('Google_Cache_File', array('directory' => 'application/third_party/Google/src/Google/Cache/'));
$client = new Google_Client($config);
So with those line you set your cache folder.
Hope this helps in the future as It helped me.
I can use GraphicsMagick to download images given a URL, however when the URL starts with a https I get the following error (for https://example.com/image.png):
Unable to open file (//example.com/image.png) [No such file or directory].
I am using the gm driver for node.js with code like so:
gm = require('gm');
gm(url).write(name);
but have also tried the gm directly from the command line with the same issue.
As stated already, it works fine for http URLS, can I get it to work for https?
GraphicsMagick uses the HTTP support from libxml2, which does not currently support HTTPS. Try using an external program like 'wget' or 'curl' (which use OpenSSL to support HTTPS) to retrieve the file. Then you can pass the returned file to GraphicsMagick.
As Bob said, HTTPS is still not supported BUT:
Using the https module you can create a buffer and input it directly into GraphicsMagick.
https.get('https://www.eff.org/files/https-everywhere2.jpg', function(response) {
gm(response, 'image.jpg')
.write('test.jpg', function(err) {
if (err) return handle(err);
console.log('Created an image from a Buffer!');
});
});