below is my request json
{"description":"Offer Pass","formatVersion":1,"organizationName":"Skywire","passTypeIdentifier":"aaaaaa","serialNumber":"123456","teamIdentifier":"vvvvvvv","generic":{"primaryFields":[{"key":"name","label":"MEMBER NAME","value":"aaaaKanodia"}],"auxiliaryFields":[{"key":"key_2","label":"Membership Number","value":"P0120417"},{"key":"key_1","label":"Expire Date","value":"04\/26\/2018"}],"backFields":[{"key":"contact","label":"CONTACT","value":"For any membership queries or feedback mail us at infor#skywire.co.in\n"},{"key":"privilages","label":"PRIVILAGES","value":"Delhi : chroma, salesindia
Mumbai : chroma, raj electronics"}]},"barcode":{"format":"PKBarcodeFormatQR","message":"P0120417","messageEncoding":"iso-8859-1"},"backgroundColor":"rgb(255,255,255)","labelColor":"rgb(0, 187, 211)","stripColor":"rgb(30, 30, 30)","foregroundColor":"rgb(0, 0, 0)","relevantDate":"2017-04-05T09:00-08:00","logoText":"","locations":[{"latitude":22.996,"longitude":72.4997}],"webServiceURL":"https:\/\/www.test.com\/qa\/skywire\/passAPI-ios\/examples\/index.php","authenticationToken":"1ef899002ccf3b9ed2f3106a38dd9cbb"}
and this is my index.php
$myfile = fopen("newfile.txt", "w") or die("Unable to open file!");
fwrite($myfile, json_encode($_SERVER));
but newfile.txt file not generated inside ftp.
anyone can help please.
Related
Assuming my endpoint receives the body of a POST request sent like this:
curl -X POST -F file=#"./<file_to_upload.pdf>" "<my_endpoint_uri>"
How can I save the received PDF onto the hard drive of the endpoint machine in Python, in a such way the PDF is exploitable by pdftotext system library?
For now, I am using the following AWS Lambda handler function:
def lambda_handler(event, context):
body = event["body"]
attachment = base64.b64decode(body)
filename, filepath = mkstemp()
os.close(filename)
with open(filepath, "wb") as pdf_bytes_file:
# Copy the BytesIO stream to the output file
pdf_bytes_file.write(attachment)
But the saved file type ("application/octet-stream") is not supported by pdftotext.
I am trying to query the data from bigquery and write it to dataframe with Airflow. But either it is giving file not found (service account key) or file name is too long or eof line read error.
I have tried with hooks as well but I am not able to do put key file as json as it is saying it is too long.
Any tips on how I can achieve it?
def get_data_from_GBQ():
global customer_data
ofo_cred = Variable.get("ofo_cred")
logging.info(ofo_cred)
logging.info("Variable is here")
customer_data_query = """ SELECT FirstName, LastName, Organisation FROM `bigquery-bi.ofo.Customers` LIMIT 2 """
logging.info("test")
# Creating a connection to the google bigquery
client = bigquery.Client.from_service_account_json(ofo_cred)
logging.info("after client")
customer_data = client.query(customer_data_query).to_dataframe()
logging.info("after client")
print(customer_data)
dag = DAG(
'odoo_gbq_connection',
default_args=default_args,
description='A connection between ',
schedule_interval=timedelta(days=1),)
And the error is:
FileNotFoundError: [Errno 2] No such file or directory: '{\r\n "type": "service_account",\r\n "project_id":...
bigquery.Client.from_service_account_json function expects file name of the service account file, you provide it with the contents of that file, so it tries to find the file which path starts with {\r\n "type": "servi... and it fails with FileNotFound.
Potential fix:
client = bigquery.Client.from_service_account_json(path_to_ofo_cred)
https://googleapis.dev/python/google-api-core/latest/auth.html#service-accounts
I m using ConvertAPI for convert doc to jpg . It works correct in PHP. But When I put same code In drupal 7 it Gives me error below
ConvertApi\Error\Api: File link is set incorrectly. URL or File Id must be set.
My code is :
require 'vendor/autoload.php';
use \ConvertApi\ConvertApi;
ConvertApi::setApiSecret('your-api-secret');
$result = ConvertApi::convert('jpg', ['File' => 'uploads/Wheels1231231a1_1.docx']);
save to file
$result->getFile()->save('uploads/file1.jpg');
I am trying to see if I can get code examples to run in my user account, rather than the testuser account. To that end, I did the following:
I have created a folder example-fraud-score under my DeployR user account (not the testuser as laid out in the tutorial, found here: https://msdn.microsoft.com/en-us/microsoft-r/deployr-data-scientist-getting-started )
uploaded the contents of analytics/ from the tutorial to the example-fraud-score directory on the DeployR server.
Attempted to run the file ccFraudScore.R, contents here: https://github.com/Microsoft/js-example-fraud-score-basics/blob/master/analytics/ccFraudScore.R using the 'Test' tab on the right after clicking on the filename in DeployR.
When I do, I get the error:
Connecting to 172.31.232.190:8000
3:53:26 PM Stream Connect matthew.pettis connection established, waiting for an event...
> require(deployrUtils)
> deployrInput("{\"name\": \"bal\", \"render\":\"integer\", \"default\": 5000, \"min\" : 0, \"max\": 25000 }")
> deployrInput("{\"name\": \"trans\", \"render\":\"integer\", \"default\": 12, \"min\" : 0, \"max\": 100 }")
> deployrInput("{\"name\": \"credit\", \"render\":\"integer\", \"default\": 8, \"min\" : 0, \"max\": 75 }")
> if (!exists("fraudModel")) {
+ load("fraudModel.rData")
Console Error cannot open the connection
API Error cannot open the connection
I tried following the post here to troubleshoot, but I could not find where my directory was: deployR cannot open the connection
When I used the script to look for the working directory (and list contents), I see:
> require(deployrUtils)
> getwd()
[1] "C:/PROGRA~1/MICROS~2/DEPLOY~1.0/rserve/workdir/conn2209460"
> list.files(getwd())
[1] "DeployREngineSource.r" "unnamedplot001.png"
This seems like the wrong directory to be using. When I try to hunt around for my directory for my user, I can't seem to find it. My DeployR version is 8.0.0.
Help is appreciated.
Thanks,
Matt
Is that the remote directory (the second box)?
If so, why don't you call setwd()?
I just wanted to know how to configure FCKEditor to upload files and images to the server where the website is hosted.
The relevant part for it's config file(i think) looks like this:
FCKConfig.LinkUpload = true ;
FCKConfig.LinkUploadURL = FCKConfig.BasePath + 'filemanager/connectors/' + _QuickUploadLanguage + '/upload.' + _QuickUploadExtension ;
FCKConfig.LinkUploadAllowedExtensions = ".(7z|aiff|asf|avi|bmp|csv|doc|fla|flv|gif|gz|gzip|jpeg|jpg|mid|mov|mp3|mp4|mpc|mpeg|mpg|ods|odt|pdf|png|ppt|pxd|qt|ram|rar|rm|rmi|rmvb|rtf|sdc|sitd|swf|sxc|sxw|tar|tgz|tif|tiff|txt|vsd|wav|wma|wmv|xls|xml|zip)$" ; // empty for all
FCKConfig.LinkUploadDeniedExtensions = "" ; // empty for no one
FCKConfig.ImageUpload = true ;
FCKConfig.ImageUploadURL = FCKConfig.BasePath + 'filemanager/connectors/' + _QuickUploadLanguage + '/upload.' + _QuickUploadExtension + '?Type=Image' ;
FCKConfig.ImageUploadAllowedExtensions = ".(jpg|gif|jpeg|png|bmp)$" ; // empty for all
FCKConfig.ImageUploadDeniedExtensions = "" ; // empty for no one
Could it be a folder permission problem? Is this part of the config.js alright?
You don't state what language you are using. The fileupload functionality in FCKeditor has ASP, .NET, Coldfusion and PHP uploaders, amongst others. It would help if you said what server (IIS/Linux?) and serverside language you are using.
With limited information its a long shot but there's settings in fckconfig.js for configuring your file browser (around line 276) Make sure you have the right language selected:
var _FileBrowserLanguage = 'php' ; // asp | aspx | cfm | lasso | perl | php | py
var _QuickUploadLanguage = 'php' ; // asp | aspx | cfm | lasso | perl | php | py
You'll also have to set write permissions on the folder structure you are uploading to (which might be the cause of the "invalid request" error, but process to edit file permissions is different depending if you are using windows or linux.
Its not well documented, but its also possible to debug the file manager settings by going to the following URLs in a browser:
/fckeditor/editor/filemanager/connectors/test.html
and
/fckeditor/editor/filemanager/connectors/uploadtest.html
The upload test scripts are very useful and can help diagnose many problems - you can see errors easier for a start. Give them a try and you should have a better idea what the problem is.
It's solved, thanks anyway. I just had to add the "Files" type to some variable at the config.aspx file. It only had "Images", so that's why I couldn't upload files