Comments (8)
A 400 error is a client error. It's possible a step may have been missed in set up.
Did you follow the set up at: https://cloud.google.com/web-risk/docs/quickstarts
to enable the webrisk API for the cloud project associated with that API key?
from webrisk.
A few things to check:
-
try modifying netAPI::doRequest in api.go to print the full error message from the request, not just the http status code. This line here:
Line 96 in 030b4b9
-
Looks like your first error reported is 'no database file specified'. This might have cascaded the further errors. See if specifying the -db flag changes anything.
-
I believe uris:search is part of the lookup API. It's possible there's a setup difference. Consider trying a curl of one of the methods from the Update API: https://cloud.google.com/web-risk/docs/update-api.
-
check the wrlookup command to see if it also gives a 400 error, since it seems using curl succeeds for that command.
from webrisk.
Yes I'm having no issues hitting the webrisk api with that key!
I've also made sure that $APIKEY has the correct value
from webrisk.
3.
Running the sample request returns expected response
curl -X GET \
-H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
""https://webrisk.googleapis.com/v1/threatLists:computeDiff?threatType=MALWARE&versionToken=Gg4IBBADIgYQgBAiAQEoAQ%3D%3D&constraints.maxDiffEntries=2048&constraints.maxDatabaseEntries=4096&constraints.supportedCompressions=RAW""
For Issue one I'm not really familiar with Go. Should I make the change then run go install?
What should httpResp.StatusCode be changed to to output the appropriate error message?
from webrisk.
Looks like wrlookup is having problems too.
I'm on mobile rn, so can't double check, but I think the best way to modify and run the webrisk server would be to checkout the git repo, make the change, then run go run
or whatever the command is. I think it would be something like go run cmd/wrserver/main.go
in the webrisk directory
from webrisk.
alright I changed the line
from
return fmt.Errorf("webrisk: unexpected server response code: %d", httpResp.StatusCode)
to
return fmt.Errorf("webrisk: unexpected server response code: %d", httpResp)
and ran the main.go script as you instructed
from webrisk.
Ahhh, I think i see the issue. I believe the API key is set incorrectly. I imagine print-access-token
would give you, well, some sort of access token. Maybe oauth. But this WebRisk CLI uses API keys
. I think the WebRisk API can use both access token and api key, which is why it worked with curl; but this client in this repo specifically uses api keys right now.
View your api keys by visiting the Google cloud console: https://console.cloud.google.com/apis/credentials
Make sure the API restrictions allow webrisk.
from webrisk.
Yeah that was it.
Perhaps the README should be updated with instructions on how to generate the api key for this sample app because if you follow the setup here https://cloud.google.com/web-risk/docs/using-sample-app
you will be instructed to first read the general setup which links to here
A brief walkthrough of how to generate the key needed for this particular project would have been very useful. Probably more useful than the entire existing quickstart guide.
from webrisk.
Related Issues (17)
- Client may not be handling percent escape the right way
- How to compute hash prefixes HOT 14
- Local DB setup HOT 3
- JSON message is not unmarshalling correctly into protobuf message HOT 1
- Make cache configurable
- Returns safe for phishing site HOT 2
- Local DB setup HOT 2
- Allow use of the Instance Metadata Service instead of using an API Key HOT 1
- Wrong doc for search browsing
- ListUpdate failure in database.go HOT 2
- IP address with space may not be canonicallzed as intended. HOT 1
- doRequest does not provide enough information when the response is not a 200
- `No Database File Specified` error when first setting up HOT 3
- Make cloud request configurable HOT 5
- Can you please return old threats endpoint from sbserver? HOT 1
- Client should not do raw GRPC post requests HOT 1
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 webrisk.