Why does Flickr's flickr.photos.setDates return error code 4, message "Invalid date_posted"? - flickr

When I called flickr.photos.setDates as documented at http://www.flickr.com/services/api/flickr.photos.setDates.html, with a date_posted value of 1185684650 (which the UNIX timestamp of a date in July 2007) I received an undocumented response, code 4, error message "Invalid date_posted". What does this error mean?

Flickr has an undocumented restriction on date_posted (and raises an undocumented response to this restriction). The restriction is that date_posted must be a time after the user in question joined Flickr (which for me was later than July 2007).
Source: http://www.flickr.com/groups/api/discuss/72157633978736704/
This is frustrating because I want to upload some old photos to my photostream via the API and want them to appear in at least approximately the right order in my stream. I am going to need to do something along the lines of spacing the date_posted values out throughout the first day after I joined Flickr.

Related

Sharepoint Online REST strange error (400) - "Value cannot be null.Parameter name: key"

Since Sep 9, 2020 we started to get strange error on REST API call to get list of sub-sites and their lists:
GET <site url>_api/web?$expand=webs,lists,AllProperties,ThemeInfo,SiteUsers,RoleDefinitions&$select=*,webs/Url,lists/Id,lists/Title,lists/Description,lists/BaseType,lists/BaseTemplate,lists/Hidden,lists/Language,lists/ItemCount,lists/Created,lists/TemplateFeatureId,lists/CurrentChangeToken,SiteUsers/id,SiteUsers/Title,SiteUsers/LoginName,AllProperties/DesignPreviewThemedCssFolderUrl
The API call was working already for few year but something is broken now and in many our customers (not all , but about 30%) we see this error.
{"error":{"code":"-2147467261, System.ArgumentNullException","message":{"lang":"en-US","value":"Value cannot be null.Parameter name: key"}}}
Now, we don't ask for any parameter "key", so not sure why it's null, but I found that if I remove the last part
AllProperties/DesignPreviewThemedCssFolderUrl
And request now looks :
GET <site url>_api/web?$expand=webs,lists,AllProperties,ThemeInfo,SiteUsers,RoleDefinitions&$select=*,webs/Url,lists/Id,lists/Title,lists/Description,lists/BaseType,lists/BaseTemplate,lists/Hidden,lists/Language,lists/ItemCount,lists/Created,lists/TemplateFeatureId,lists/CurrentChangeToken,SiteUsers/id,SiteUsers/Title,SiteUsers/LoginName
Then this request is returns fine, without any error
#Sharepoint team, maybe some new versions was deployed and some behaviour changes / bugs were introduced ?
Please advise,
Thanks
So this could be because of URL length Max limit in SharePoint.
Path length limit in SharePoint Online is 400 characters.
Path length limit in SP 2013 on-Prem is 255 characters.
Try to remove unnecessary columns or make the url shorter by URL shorteners.

How to get a certain (e.g. second or third) mention sent in a message

I've been trying to make a ship command that can either ship the author of the message with a mentioned user, or ship two mentioned users. I can get the 1st mention in a message but I have no idea on how to get the 2nd or even third mention in a message. I tried using:
message.mentions.users.first(2)
splitting the args then slicing them so only the second mention is avalaible, but this gives an "undefined" error when I try to get the username.
Could someone give me a script on exactly how to do it since I can't really get the hang of this
According to the documentation message.mentions.users yields a Collection. So you can just iterate over this collection or convert it to an array and then access the required index:
const userArray = message.mentions.users.array();
console.log(userArray[yourDesiredIndex]);

Correct parameters for RateCard API

I am trying to fetch the RateCards for my Azure subscription, however I am unable to figure out the correct (combination of) parameters for my call to the API. I keep getting the following message:
{
"Message": "Invalid query specified. Please specify valid values for OfferDurableId, Currency, Locale and RegionInfo."
}
I'm currently supplying the following parameters:
$filter=OfferDurableId eq ’MS-AZR-0003P’ and Currency eq ’EUR’ and Locale eq ’en-US’ and RegionInfo eq ’NL’
I'm not certain whether there are any requirements between the OfferDurableId, Currency and Locale parameters, but I think these are fine. The parameter I'm mostly confused about is RegionInfo. As per the documentation (whatever little there is), this is the 2-letter ISO code which represents the country in which I purchased my subscription. I am quite certain that this was bought in the Netherlands, hence my attempt with NL, but it doesn't work. I've tried IE, GB, US and some neighbouring countries, but none of them work.
I should mention, the example in the docs (MS-AZR-0003P, USD, en-US and US) doesn't work for my subscription either, I'm guessing due to a mismatch in RegionInfo.
What would be a correct combination of values? Where would I find these values? (e.g. where would I find RegionInfo?)
As per #GauravMantri's response, the issue was indeed in the quotes. The "weird backquotes" (which were copied straight from Microsoft's documentation itself) are the issue. When replaced with normal single quotes (and after url-encoding the $filter value), the query works and returns my rate cards.

Extract 'p' data from 'div' with Class of div = ""

I am trying to extract the data in the div with "" as className followed by p tag.
My html looks like this
<div class=""><p>I've been with USAA since 1981 - they've been a good, helpful company and easy to deal with except with making payments on their website. Every time I try to make a payment the website has a problem and I end up calling them. Today, I tried to make a credit card update (same account, different exp. date and code) before I made a payment. The website kept telling me it wouldn't accept the information.</p><p>I called the company to make the payment and was told the system had accepted the information but I couldn't make the payment until tomorrow because of the update. They refused to let me make my payment by phone. 4 times in the past 2 years it wouldn't accept my password, even after I confirmed it by - yes calling in. Other payments have not been accepted for unknown reasons - I've had to call them in. No point having a website if it doesn't work. I avoid calling because it takes so many steps to reach a live person. It's a minor complaint but it happens every time.</p></div></div>
I am using Beautifulsoup and my code to extarct this data is :
reviewAllList = [row.text for row in soup.find_all('div',attrs={"class" : ""})]
However, I am not able to extarct the correct data from the same. Is it that I am missing something? I am using Python 3.5.
Use lambda to find all divs with an empty class attribute andthe first child is a p
rows = [str(row.get_text(strip=True)) for row in soup.find_all(lambda tag: tag.name == "div" and ("class" not in tag.attrs or not len(" ".join(tag["class"]))) and tag.findChildren()[0].name == "p")]
You can just print the text only by saying.
sometxt = <div class=""><p>I've been with USAA since 1981 - they've been a good, helpful company and easy to deal with except with making payments on their website. Every time I try to make a payment the website has a problem and I end up calling them. Today, I tried to make a credit card update (same account, different exp. date and code) before I made a payment. The website kept telling me it wouldn't accept the information.</p><p>I called the company to make the payment and was told the system had accepted the information but I couldn't make the payment until tomorrow because of the update. They refused to let me make my payment by phone. 4 times in the past 2 years it wouldn't accept my password, even after I confirmed it by - yes calling in. Other payments have not been accepted for unknown reasons - I've had to call them in. No point having a website if it doesn't work. I avoid calling because it takes so many steps to reach a live person. It's a minor complaint but it happens every time.</p></div></div>
and now just print(sometxt.text)
if you're only looking for the div class= > "" <
You can print it by print(sometxt['class']) remember that you might have to itterate through your findAll with a for loop to do this.(if there's multiple class)
**row.text**
I assume you just want to get the text from the paragraphs.
You could do something like:
mydiv = soup.find("div", { "class" : "" })
for p in mydiv.find_all('p'):
text_list.append(p.get_text())
or
mydiv = soup.find("div", { "class" : "" })
text = mydiv.find('p').get_text()
Can not test right now, but from my experience with BS this should work fine.
Edit: tested and corrected it.

Netsuite bug when creating customerdeposit record

Im trying to create a customer deposit record in Netsuite using suitescript 1.0.
The original code I had in place which had been working perfectly up until the 2016.2 release broke it.
The update broke it, in that it would override the value submitted in the payment field and instantly make it the full amount of the sales order from the sales order ID. Which is not what we need it to do.
Original Code
function createDeposit(request,response)
{
var record = nlapiCreateRecord('customerdeposit');
record.setFieldValue('salesorder','1260');
record.setFieldValue('customer','1170');
record.setFieldValue('payment','100');
record.setFieldValue('account','2');
record.setFieldValue('memo','this is a test');
deposit = nlapiSubmitRecord(record,true,false);
response.write(deposit);
}
After a reply on the Netsuite user group prompted me to use the {recordmode:'dynamic'} attributes I am getting a strange error..
Test Replacement Function which doesnt work
function createDeposit(request,response)
{
var record = nlapiCreateRecord('customerdeposit',{recordmode:'dynamic'});
record.setFieldValue('salesorder','1260');
record.setFieldValue('customer','1170');
record.setFieldValue('payment','100');
record.setFieldValue('account','2');
record.setFieldValue('memo','this is a test');
deposit = nlapiSubmitRecord(record,true,false);
response.write(deposit);
}
The error message Im getting now is
Invalid salesorder reference key 1260 for customer .
The thing I dont get is how it is now considered NULL, when the value is hardcoded into this test script after I apply the {recordmode:'dynamic'} value.
Ive tried a wide variety of things, but as I dont have Netsuite support, its proving to be something I simply cant figure out.
Any hints, suggestions would be greatly appreciated as Ive been on this for several days
When you use dynamic the order you set fields makes a difference. So when you set the sales order prior to setting the customer you are actually getting the error message "Invalid salesorder reference key 1260 for customer blank"
What I do is create the customer deposit like:
var depRec = nlapiCreateRecord('customerdeposit', {entity:soRec.getFieldValue('entity'), salesorder:soId});
also setting the undeposited funds flag seems to be required (but not always for some reason) so since you are supplying an account id also do this:
depRec.setFieldValue('undepfunds', 'F');

Resources