python upload image from a url to google drive api - python-2.7

For my Python app,I had completed the basic settings to interact with google drive api and found it working by a test upload of a CSV file. Now I need to upload an image from a url to a newly created folder named 'myappname' in Google Drive.
Thanks in advance

For now, there is no way you can directly upload file from url. There are two workaround I can think of
Download file and upload it back using Files.insert()
Use Save to Drive button
Using save to Drive button requires user interaction to click the button which might not be the one you want. In that case, downloading and uploading is the only way I can think of.

Related

Django application to upload videos on S3 using boto3

I am new to Django and want to develop an application to upload videos on AWS S3 using Boto3.
Please guide me step-by-step on how to implement this?
As I am new it's little hard for me to understand.
Earlier I tried and created one Form with form.FileField() and it returns File Object but that fileobject I am not able to upload using boto3 as upload_fileObj method must require read implemented as a rb.
Thanks in advance and waiting for guidance.
You should first create a file from your File Object in /tmp/ directory.
After that you can use that file path to upload using upload_file
once you are sure that the file is uploaded successfully you can delete that file from /tmp/ directory.
Incase, file is not being properly uploaded you can retry it also.

How to upload images in Siebel application for further sending via web service?

im newbie in Siebel CRM.
I have a task of creating form applet that has functionality of uploading images and also some text records.
What I need to do is: send images and some text via WS(f.e. using SOAP) to external application and also save text information in siebel db.
My problem is that I cant create form applet with upload button and then submit button that processes given record as I described before.
PS: Appreciate if u give detailed information, Thanks !
Such functionality can easily be achieved using Siebel's attachment business components. For instance, under Service Requests, there is an attachments tab. Files can be uploaded here. Later for integration, your could simply use EAI Siebel Adapter BS in a Workflow, that will convert the binary attachment to base64 in the XML, which can be sent out. Users can upload any kind of file in different records.
Siebel OpenUI can show some images in Contact tiles uploaded into urls intead of files:
http://www.brucedaley.com/siebelobserver/2014/02/tiles-and-images.html
It can be done without using attachment BCs, with ordinary JS code in PR/PM file. I had to do it so users can upload PDF files, which had to be base64 encoded and sent via WS afterward but not saved in Siebel. I've used JS FileReader object (MDN) and JS out of the box base64 encoding (MDN docs).

Sharing files from google cloud storage to GAE

I have one Django application running GAE.The application uses content folder which contains images and html snippets.The content folder was uploaded in google cloud storage.I would like to render a image in static file using img tag.For using img tag I want to know the url of that image.I have seen that when we set the permission to share publicly it will give us a url.But I don't want to share that files publicly.If I share an another application can use my files.I don't want that.I there any way to do that with out log in a user
Sharing it publicly is the best way to go.
You could also base64 encode the image data when you render out the template, which means the url of the image will not be shown to the public on your page. Then you can obfuscate the image names in the GCS. This way it's still public but hard to reach.

Can I make a dropbox folder public by using python client?

I am using dropbox for one of my application where a user can connect their dropbox folders.
Usage is such that a user can create links among the files of a folder and many more. But the problem is the moment when I stored the file information in my application, the file media information is stored with a key expires. So obviously I wont be able to use the link next time once the expiry time is met.
One way is to generate the media information every time the user is selecting a thumbnail from my application, as I already have metadata of the file.
But is there any other way (i.e by using python client or API) that I can make a folder public when a user selects it to connect with my application.
Any help would be really appreciated.
Thanks in advance for your precious time.
I think the right thing to do is to generate a media link each time you need it.
Is there a reason you don't like that solution?

Django Admin doesn't recognize files uploaded on Google App Engine

I am using Django 1.4 on Google App Engine.
I have a model called Media, where the admins can upload files to use in their website. It has a field:
file = models.FileField(upload_to='/uploads/%Y/%m/%d')
It works perfectly with images (although the URL provided is weird), but that is not a problem.
The problem is when they try to upload a PDF (or anything else). Everything seems to work, but when you go to edit it, it doesn't contain any file - there is no "Currently" or anything else.
If I go to Google App Engine dashboard, the file is in Blob Viewer, and the record is also saved and available through the Datastore Viewer, with the correct blob key.
Why Django is not recognizing it? And how I can fix it?
djangoappengine contains a storage provider for the blobstore.
To me it doesn't seem like a full-featured solution, just something to get file uploads running.
I had to add this to get some functionality I needed (urls to the files).
It might make the admin work too:
https://github.com/dragonx/djangoappengine/commit/6a472a80c25bc077816c9104b45d5a64f3063273