invite user to a dropbox folder using python sdk - python-2.7

In my application I am sharing a set of images from one of my dropbox folder to few people and wrapping some control over it.
Since I am using client.media('path_to_image'), I am getting the exact url and putting it in html as
<img src="the url returned">
, but with an expiry duration.
But it wont be available to other unless the image_path is available in other user's dropbox.
Though the client.share('path_to_image') gives a public url whose expiry date is set too ahead but, the url it returns is shortend one. So I wount be able to use that url in html img tags as src.
So the only way I could short out is to invite the users to my folder so that the image path available in there dropbox client too.
Is there a way to invite users to my dropbox folder, using dropbox python sdk or api.
Any help would be really appreciated.
Thanks in advance.

I'm not sure I understand your problem, or you might be misreading the documentation for client.media(). The URL returned by that API can be used by any user without authentication (until it expires) so it's suitable for use in an tag as you suggest.
If the short URL from client.share(path) is a problem, you can call client.share(path, short_url=False) and get an unshortened URL. The links you get from that call don't lead directly to the image, though, but to a web page on which the image can be viewed or downloaded. You can actually create a direct-download link (unexpiring) from a share link if you replace www.dropbox.com with dl.dropboxusercontent.com in the URL.

Related

How to updatde current URL while uploading document in SharePoint 2013 using CSOM

I am trying to change URL while uploading document to SharePoint document library using CSOM.
Description:
We have 'XYZ' document library with following folder structure:
Folder 1
SubFolder 1
- All Documents
Now I am trying to upload document at Folder 1. and after Drag and Drop document is getting uploaded to Folder 1. What I want to do here is, Whenever user try to upload document in Folder 1, it should get uploaded to SubFolder 1 . Is there any way to change URL of document in CSOM while its getting uploaded. So that it will get uploaded to 'SubFolder 1' even though user is doing DRagDrop to 'Folder 1'.
I am getting current folder URL in state.Status= Uploading event. I want to update this URL by adding 'Subfolder 1' to currentURL , so that it will upload this document direct to updated URL.
Note: If you have any other way to do it please let me know. also Cant go for Server side code. need CSOM.
Thank you in advance.
I have implemented similar requirements before and would recommend using a workflow for this. I have left out the step for getting the FormDigestValue by making a call to /_api/web/contextinfo, but that is needed in the request header.
The following URL format is used to call the API to move the document. Here is some documentation on the API.
/_api/web/getfilebyserverrelativeurl('/Folder1/file.pdf')/moveto(newurl='/Folder1/SubFolder1/file.pdf',flags=1)

Joomla Search issue ".com/index.php/component/users/?view=reset"

I am using Joomla for my website when I search in google for SAPBuddy I always get search result.
Can some one help me I tried to add my side in Google webmaster, but the result is same.
sapbuddy.com/index.php/component/users/?view=reset
Check you've followed these steps.
Create a sitemap. You can use an online tool for this, or a Joomla extension
If you used an online tool to create your sitemap, upload the site the xml file to your server. If you're using an extension, follow their direction. When finished, you should be able to open it with your web browser, e.g. www.domain.com/sitemap.xml . Check if the indexed pages looke good and copy this URL
In webmaster tooks, add your domain then register this sitemap, pasting in your URL
After a short period, check back on Webmaster tools. It will show which pages have been indexed and if there were any errors.
Good luck!

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

Iframe working correctly on localserver but not production server

A question like this was asked before and the person got nothing but criticisms, hope this won't be the case here.
I have a website that allows a business to add their menu to my site, and some have requested to be able to import a menu (a pdf or jpg) that is already online elsewhere. So I made a form that saves a url to the db and then that url is used in the src of an iframe on my site.
I tested it all and it worked fine on my local machine (using Django development server). When I synced it over to my production server and saved the same url I was testing with, the iframe loads no content.
I imagine that it has something to do with trying to read an individual file from another server because it works if I make the url google.com or to an image that is under my domain name. Is there anything I can do to fix this? Storing a url instead of a pdf in my db is much more efficient so doing this way is preferred over uploading their menu to my site.
I don't think this question needs any code attached, but if you want to see some let me hear it.
Thanks
The menu you're testing with probably has the X-Frame-Options response header set.
Is there a reason you're putting the image/pdf as the src on an iframe instead of just using the img tag (or putting an img tag inside your iframe)? There's still no guarantee that will work for all pages, as some sites will refuse to serve media to an external page, but I suspect this is your problem in this case.

Django: control access to "static" files

Ok, I know that serving media files through Django is a not recommended. However, I'm in a situation where I'd like to serve "static" files using fine-grained access control through Django models.
Example: I want to serve my movie library to myself over the web. I'm often travelling and I'd like to be able to view any of my movies wherever I am, provided I have internet access. So I rip my DVDs, upload them to my server and build this simple Django application coupled with some embeddable video player.
To avoid any legal repercussions, I'd like to ensure that only logged-on users with the proper permissions (i.e. myself and people living in the same household, which can, like me, access the real DVDs at their convenience), but denies it to other users (i.e. people who posted comments on my blog) and returns an HTTP 404.
Now, serving these files directly using Apache and mod_wsgi is rather troublesome because when an HTTP request for the media files (i.e. http://video.mywebsite.com/my-favorite-movie/) comes in, I need to validate against my user database that the person at the other end has the proper permissions.
Question: can I achieve this effect without serving the media files directly through a Django view? What are my options?
One thing I did think of is to write a simple script that takes a session ID and a video's slug and returns some boolean indicating if the user may (or may not) access the video file. Then, somehow request mod_wsgi to execute this script before accessing the requested URL and return an HTTP 404 if the script failed. However, I don't have a clue if this is even possible.
Edit: Posting this question clarified some of my ideas for search and I've come across mod_python's file wrapper extension. Does anyone have enough experience with that to validate that it is a viable solution?
Yes, you can hook into Django's authentication from Apache. See this how-to:
Authenticating against Django’s user database from Apache