I'm failing to connect to HateBase API. I have broken down the code here to make the debugging easier:
key ='blah blah'
base_url = 'https://api.hatebase.org'
url = "https://api.hatebase.org/4-4/authenticate"
payload = "api_key=" + key
response = requests.post(url, data=payload, headers=headers)
token = response.json()
print(token)
output:
{'datetime': '2022-03-02 18:32:13',
'errors': {'8752': 'The version of the API is now retired; please update your queries to resume accessing the API'},
'important': "Your use of the HateBase API acknowledges your consent with Hatebase's Terms of Use (available online at hatebase.org) and PROHIBITS REDISTRIBUTION of this data for any purpose, including but not limited to republication in any form, such as in PUBLIC CODE REPOSITORIES.",
'query': {'api_key': 'blah blah'},
'version': '4.4'}
I'm not sure if there is a problem with HateBase API itself... Alternatively, I'd be thankful if anyone knows a source that has already collected all HateBase Vocabulary.
Apparently Hatebase is no longer being actively maintained, so they retired the Hatebase API. I sent them an email about it and they suggested I try Weaponized Word instead.
"A good alternative is The Weaponized Word, a new project which is
very similar to Hatebase: it's free for eligible academic researchers,
and has a multilingual lexicon, an API and a built-in natural language
parser. At this time, language coverage on The Weaponized Word is
roughly twice the size of Hatebase's lexicon."
That was very frustrating for me as well, because I last used the API end of 2021 so I was not sure what was happening. I haven't tried the new tool yet, but I'm happy that at least they offer an alternative :)
Related
I am attempting to create a single opening balances record against an existing employee but keep getting a 400 Bad Request response with this detail...
At least one NZ opening balance item is required in the request
I am following the instructions as per this documentation...
https://developer.xero.com/documentation/api/payrollnz/employeeopeningbalances#post-opening-balances
URL : {DestinationID} is properly replaced with the employee GUIDhttps://api.xero.com/payroll.xro/2.0/employees/{DestinationID}/openingBalances
JSON Body[{"periodEndDate":"2011-01-30T00:00:00","daysPaid":5.00,"unpaidWeeks":0.00,"grossEarnings":1442.31}]
The Xero forums and support is pretty unreliable so I'm posting here in the hopes for a better response.
After some trial and error using the API Explorer that Xero provides I was able to get it working using their example....
I eventually learned that daysPaid and unpaidWeeks must both be integer whole numbers or else it fails.... The error message provided is misleading but this resolves the problem.
This is my first post here though have been using the great advice/solutions here for years so am very grateful. But this one, I can't find solution for.
I have an MS access front end/back end in use for various office admin tasks and records. Much of the data my office works with on a daily basis is cloud based. However API access is provided with app key and secret key. I have no issues using the API explorer with these keys, but can't get anything through code (VBA). I keep reading it is perfectly possible to do this with VBA which is why I kept trying different solutions, but now need help. (I have replaced URL and keys etc)
Dim myObj As New MSXML2.XMLHTTP60
Dim url, endPoint, params, tickers, appKey, secretKey As String
url = "theURL.com"
endPoint = "theEndPoint"
params = "id="
tickers = "1"
appKey = "12345678"
secretKey = "12345678"
myObj.Open "GET", url, False
myObj.setRequestHeader "Content-Type", "application/json"
myObj.setRequestHeader "app-key", appKey
myObj.setRequestHeader "secret-key", secretKey
myObj.send
This returns "App Key is required." I have tried various solutions including converting keys to Base64, putting the keys within the Open request, sending the keys as part of the send request etc. Always get "App Key is required" when reading response. I know in this code I have't actually requested anything but that returns same message when I do. I just wanted to keep what I posted simple.
Any help at all is greatly appreciated as this would allow great deal of automation for our office.
Thanks
James
I am getting an error when trying to call on the Foursquare places API about my versioning being old, however the date specified in the error is much older than the date I am using. Am I missing something?
This is for a certification project, can someone please advise what's going on, I have not found any resources on this. I have tried versioning dates 20180604 and 20180323 and get the same error. I have attached my code.
CLIENT_ID = 'xxxxxx'
CLIENT_SECRET = 'xxxxx'
VERSION = '20180604'
LIMIT = 30
Latitude = 38.925496298
Longitude = -77.0350515265
And this is the error when I try and call results
results = requests.get(url).json()
ERROR: 'meta': {'code': 410,
'errorType': 'param_error',
'errorDetail': 'The Foursquare API no longer supports requests that pass in a version v <= 20120609. For more details see https://developer.foursquare.com/overview/versioning',
'requestId': '5f4e58420179823aae7b5f91'},
'response': {}}
It works now. I am not sure why it wasn't before (the only thing I did differently was install Folium) but in any event it is now working. Sorry I can't offer more clarity around this. If others are having similar issues, I would try using a different environment. I was operating in IBM Watson Studio and switched to my local instance of Jupyter, confirmed it worked, then it worked when I went back to Watson. So I'm not sure, but that's what I can offer.
I am QA engineer. The Dev team produces documentation for our product's RESTful API using Swagger. I need to import this to Postman to make it easy to invoke the product's API.
After importing the JSON file (in Swagger format) into Postman, there is 1 but big problem: All titles (and descriptions) of individual requests are blank! (see screen shot below).
Apparently, this is a known issue, documented here: https://github.com/postmanlabs/postman-app-support/issues/1434
We have literally hundreds of requests. I need to find a sufficiently effective yet simple way to ensure all request titles in Postman are populated with a value which I would like to calculate on the fly.
I have been considering the following approach:
Write a command line tool (using NodeJS or another
solid platform) which will receive:
1. ID of the collection to fix
2. api key
It will iterate through all requests in the
collection. For each request: if Name field is
blank, then a substring of the request URL
will be assigned to the Name field; if name is
not blank, the request is left alone.
What I am unsure about:
Can I do this programmatically from Postman? It does not make sense to put this code into any one individual request (as pre or post).
(If I have to code this util outside of Postman)
For NodeJS there are "postman-collection" and
"postman-sdk" but I am slightly confused which I
should use.
Unfortunately, I have not yet found any suitable > library for maintaining Postman collections using C# > or Java.
I am quite frankly confused by the available options. Any guidance will be appreciated.
I had the same problem, solved it thanks to Ian T Price solution (just copy operationId value into a new key summary). I decided to write a little javascript utility for this:
function swagPostman(swaggerJson) {
for (let path in swaggerJson.paths) {
let methods = ["get", "head", "post", "put", "delete", "connect", "options", "trace", "patch"];
methods.map(method => {
if ((swaggerJson.paths[path] || {})[method]) {
swaggerJson.paths[path][method].summary =
swaggerJson.paths[path][method].operationId;
}
});
}
return JSON.stringify(swaggerJson);
}
Also made a simple pen where to run the script with a GUI: https://codepen.io/0x616c65/full/pMaQpb. You just copy-paste your swagger.json file in that pen and woilĂ !
A simple answer to this is to add a line summary: <RequestName>
I came across this problem using the excellent APIs-Gurus OpenAPIDirectory repo
These swagger.yaml files have a operationId: line which can be duplicated and the key replaced with summary: using:
awk '{if (!/ operationId:/) {print ; next} ; { print; a=gensub(/ operationId:/, " summary:",1) ; print a}}' swagger.yaml > swagger-new.yaml
Importing this into Postman then shows the correct request name.
PostMan is separating out the Import/Export functions in to separate plug-ins but their plug-in model leaves a lot to be desired at the current time.
Using the Bloomberg API, how do I request the price information for the HTUSMOML and GSTHHVIP indexes.
Part of the basic code which I am using is listed below:
session.OpenService("//blp/refdata");
Service refDataService = session.GetService("//blp/refdata");
Request request = refDataService.CreateRequest("ReferenceDataRequest");
request.Set("security", "HTUSMOML US INDEX");
request.Set("security", "GSTHHVIP US INDEX");
request.Append("fields", "PX_LAST");
request.Append("fields", "OPEN");
I get an error of "Symbol not available in service: ReferenceDataRequest.
Thanks
RC
Have you tried using the same syntax and asking for a well-known index, like INDU or QQQQ or something? That would eliminate a lot of possibilities.
If that works, then are you sure there is reference data available for these indices? Sometimes they only have pricing data, not reference data.
Next, are you sure you are permissioned to get this data? Either you may not be allowed, or your API setup may not be providing proper authentication for an account that does have permission.
If none of that works, you really need to follow Help Help and call the analytics desk for assistance.
There are a few issues with your code you should address:
You're setting the security twice, the second time overrides the first
You probably should be doing
request.Append("securities", ...);
The yellow key which you're specifying should be given in lower case.
Index securities don't have an exchange in their name - lose the US, it's just "HTUSMOML Index"
I recommend not using the yellow key at all, instead use the Bloomberg Global Identifier in this format:
request.Append("securities", "/bbgid/BBG000RGBSK8");
(BTW, BBG000RGBSK8 is the actual Bloomberg Global Identifier for HTUSMOML Index)