I have written a script on publish channel and would be triggered before processing. I have to fetch the GLaccount and when trying to do that it returns null value. The piece of code is
irData.getCurrentData("GLDEBITACCT) or even this irData.getCurrentData("VALUE"). I guess this is incorrect because in the XML the GL account appears something like below,
<GLDEBITACCT>
<VALUE>00.00000.00000.000000</VALUE>
<GLCOMP glorder="0">00</GLCOMP><GLCOMP glorder="1">00000</GLCOMP>
<GLCOMP glorder="2">00000</GLCOMP><GLCOMP glorder="3">000000</GLCOMP>
</GLDEBITACCT>
There is a getGL method in psdi.iface.mic.StructureObject . If you pass the GL component name it will fetch value.
Related
I have a data frame:
I want to automatically insert the data frame details in quip. I have searched online, but couldn't find any satisfactory answer. Please help
here is my answer based on a similar problem and this article: https://towardsdatascience.com/updating-a-quip-spreadsheet-with-python-api-1b4bb24d4aac
First, follow the step to get and use a personal access token from quip.com/dev/token--this will help with your authentication.
Then, you can get an updated client version from Lynn Zheng's medium post (linked above) https://github.com/RuolinZheng08/quip-api for local import.
My imports look like this:
import quip_update as quip #from Zheng's repo
from login_token import login_token #this is a variable that holds the value of the token I got from their auth website
Then you setup/authorize the client with the following:
quip_client = quip.QuipClient(access_token=login_token, base_url='https://platform.quip.com')
user = quip_client.get_authenticated_user()
If your company has a contract with quip, it might look like base_url='https://platform.quip-amazon.com'
I like to print(user) to see basic info/that the client connected.
Then, again mostly narrating Zheng's article, you can use one of the client functions to insert a spreadsheet:
def add_to_spreadsheet(self, thread_id, *rows, **kwargs):
'''Adds the given rows to the named (or first) spreadsheet in the
given document.
client = quip.QuipClient(...)
client.add_to_spreadsheet(thread_id, ["5/1/2014", 2.24])'''
from quip.py
So you can put a spreadsheet in manually and then call to it by name="name of spreadsheet" to incorporate rows from Pandas.
So, for example:
I'm using python. I am trying to retrieve all payouts to a certain destination.
The code for retrieving everything is:
stripe.Payout.list(limit=3)
How do I add a parameter containing the destination ID? (Destination ID is in this form: ba_XXXXXXXXXXXXXXXXX)
I actually figured it out. This is not included in stripe API documentation. Just add a field like this:
stripe.Account.retrieve(destination = "ba_XXXXXXXXXXXXXXXX")
The only problem is this doesn't allow NOT filters. I can't do !=. It has to be = only. I haven't tried with > or <. Can anyone help me with this?
I'm new to this, I've successfully been web scraping from this website but having difficulties with this operation. The difference this time is that I need to change the value of "soapAction".
<wsdl:operation name="assignPartNumber">
<wsdlsoap:operation soapAction=""/>
In previous scripts, I've got all my information from the operation name. If I run this in my whole script, I get the error message,
INVALID DATA IN ACTION CODE FIELD. PLEASE ENTER 1 OR 2
How would I change the value of soapAction? Thanks
I would usually get information from a soap operation, such as assignPartNumber, by using this line
data = mylogin.service.assignPartNumber(user, info1, info2, info3)
I am working on a Python script, in that I am printing all stream information of perforce using:
p4 -ztag stream -o //streams/xyz
output looks like:
Stream //streams/xyz
Update 2015/03/12 16:05:33
Acessed 2014/03/14 09:55:38
Owner abc
Parent //streams/klm
Remapped0 fgh/hjk....
Remapped1 uhk/dtj...
Remapped2 hjjk/.. etc
this way output is coming.
I am calling from python as :
subprocess.Popen(['p4','-ztag','stream','-o',//streams/xyz], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0]. Now, i want to display only Path fields not the rest i.e owner, update, access, etc. So, how will i get this?
Now I want to have the information regarding only one field named as "Remapped" not the rest like owner, Parent etc.
So, How do I use the filter command to get only the specific field?
I'd recommend using the P4Python API, which will make it very simple:
http://www.perforce.com/perforce/doc.current/manuals/p4script/python.p4.html#python.p4.fetch_spectype
http://www.perforce.com/perforce/doc.current/manuals/p4script/python.p4_spec.html
p4.fetch_stream( "//streams/xyz" )._Remapped
will get you the value of the Remapped field, etc.
I am dealing with the Box.com API using python and am having some trouble automating a step in the authentication process.
I am able to supply my API key and client secret key to Box. Once Box.com accepts my login credentials, they supply me with an HTTP GET parameter like
'http://www.myapp.com/finish_box?code=my_code&'
I want to be able to read and store my_code using python. Any ideas? I am new to python and dealing with APIs.
This is actually a more robust question than it seems, as it exposes some useful functions with web dev in general. You're basically asking how to separate my_code in the string 'http://www.myapp.com/finish_box?code=my_code&'.
Well let's take it in bits and pieces. First of all, you know that you only really need the stuff after the question mark, right? I mean, you don't need to know what website you got it from (though that would be good to save, let's keep that in case we need it later), you just need to know what arguments are being passed back. Let's start with String.split():
>>> return_string = 'http://www.myapp.com/finish_box?code=my_code&'
>>> step1 = return_string.split('?')
["http://www.myapp.com/finish_box","code=my_code&"]
This will return a list to step1 containing two elements, "http://www.myapp.com/finish_box" and "code=my_code&". Well hell, we're there! Let's split the second one again on the equals sign!
>>> step2 = step1[1].split("=")
["code","my_code&"]
Well lookie there, we're almost done! However, this doesn't really allow any more robust uses of it. What if instead we're given:
>>> return_string = r'http://www.myapp.com/finish_box?code=my_code&junk_data=ohyestheresverymuch&my_birthday=nottoday&stackoverflow=usefulplaceforinfo'
Suddenly our plan doesn't work. Let's instead break that second set on the & sign, since that's what's separating the key:value pairs.
step2 = step1[1].split("&")
["code=my_code",
"junk_data=ohyestheresverymuch",
"my_birthday=nottoday",
"stackoverflow=usefulplaceforinfo"]
Now we're getting somewhere. Let's save those as a dict, shall we?
>>> list_those_args = []
>>> for each_item in step2:
>>> list_those_args[each_item.split("=")[0]] = each_item.split("=")[1]
Now we've got a dictionary in list_those_args that contains key and value for every argument the GET passed back to you! Science!
So how do you access it now?
>>> list_those_args['code']
my_code
You need a webserver and a cgi-script to do this. I have setup a single python script solution to this to run this. You can see my code at:
https://github.com/jkitchin/box-course/blob/master/box_course/cgi-bin/box-course-authenticate
When you access the script, it redirects you to box for authentication. After authentication, if "code" is in the incoming request, the code is grabbed and redirected to the site where tokens are granted.
You have to setup a .htaccess file to store your secret key and id.