Flask API for uploading a video - flask

I like to write an api that accept from the user a video via a post command. Any body can let me know how can I use Flask-Uploads for extensions mp4 or other video extensions?

The version of Flask-Uploaded on PyPi is broken since February 2020.
You can use the drop in replacement: https://pypi.org/project/Flask-Reuploaded/
When you want a file extension, which is not contained in a pre-defined set, you just can create your own one.
e.g.
VIDEOS = tuple("mp4 mov")
and then configure Flask-Reuploaded as described in the documentation, i.e
videos = UploadSet('videos', VIDEOS)
If you do not want to use Flask-Reuploaded, there is a very good blog post by Miguel Grinberg explaining all the details - without using an upload extension:
https://blog.miguelgrinberg.com/post/handling-file-uploads-with-flask

Related

How to render a pdf file as pdf in browser using django

I am using Django web frame work. I am taking pdf files from users (notes/book/etc). Then I want to display those pdf in website, but I could not find a way. Methods that failed 1)iframe 2)simple rendering using django 3)pdf.js library. Also browser blocks rendering initially. Care to suggest a method and steps to implement it.
I the answer to your problem is here :
https://docs.djangoproject.com/en/3.0/howto/outputting-pdf/
Well the answer has to be very very clear here. You can not display pdf using. There is no such library for that. Like pdf.js for javascript based frameworks. I have done the research. So if you want a really good pdf viewer for your django powered website you have to use pdf.js for sure. I have asked people working with django professionally.
output in firefox
ouput in chromium browser
Now 2nd output is what we want
here is the code

Postman: How to Export/Download API Documentation from Postman?

I have developed a collection in postman having a bunch of API Endpoints. I can add team member to my Postman workspace and also can share the Documentation link publicly online.
What I was finding to have a download link to download the documentation as a folder so that I could add them into my project.
Is there anything I failed to find in postman?
You can export the collection as a json as shown in the other answer and then run a tool to convert it into an HTML document that you can host wherever you want.
I created a simple python executable to do just that -
https://github.com/karthiks3000/postman-doc-gen
Hi #Siddiqui currently this feature is not available, I do it by going to my collection documentation and getting it to print when the print prompt is shown I save the document as PDF before finalizing the print options. Once I get it in PDF I have all sorts options to do as I want. This is the closest I have been to downloading my collection documentation.
I have redacted information for privacy.
Hope this helps or leave a comment if I can be of any further assistance.
Postman generated API documentation is meant to be shared and consumed via workspace and URL to help ensure it is kept up to date and does not go stagnant. Because documentation will most likely be regularly updated with examples, new endpoints, and other elements anything downloaded will quickly be out of date. I know that a PDF generated version has been discussed as part of future releases, but keeping API documentation up to date is the priority.
A simple solution to this is to print the page to PDF from the web browser. It's not perfect but it is usable.
https://learning.postman.com/docs/getting-started/importing-and-exporting-data/
to export the doc to json
and then run the script by #karthiks3000 (https://github.com/karthiks3000/postman-doc-gen)

How to use URL resolver

Is it simple how urlresolver works? How do I use it in my addon? Do I just import it and it's going to work or do I have to call it somehow and give the embedded link I get from the web site?
Can someone give a clear understanding or point me to a good post that explains it and show how to use it?
The URLResolver Kodi add-on works in the background of Kodi (called a dependency) to decode file hosts in order to play the root movie or TV video stream. If you are new to Kodi, you probably notice that a lot of add-ons use the same filehosts – Gvideo, clicknupload, zshare, dizilab are some of the popular ones. The URLResolver Kodi add-on knows how to navigate through these hosts, clicking through captcha’s and virtually retrieving the streaming file which you see in Kodi.
URLResolver is automatically installed with any add-on that uses it, so you probably have the latest Kodi URLResolver update on your box without event knowing it.
For more information visit following link:
http://bestforkodi.com/url-resolver-the-most-used-addon-that-stays-in-the-background/
Example how to use it check following github repo:
https://github.com/Eldorados/script.module.urlresolver

File browser with Django and Alfresco

I have a Django site and a local install of Alfresco (community edition). One of my model contains a file reference which maps to a document in Alfresco. The view should have a field that spawns a file browser that can access the repository structure within Alfresco so that the user can pick whichever file they want at whichever version.
I looked at the CMSIlib module and it seems to be providing all the interaction I need for the back end code. Although downloading a document seems clunky.
There are lots of Django file browsers but none seem to interface with CMSIlib.
Do I have to code my own or have I missed something?
The version is Alfresco Community v5.0.0 (d r99759-b2) schema 8022 Spring Surf and Spring WebScripts - v5.0.0.
To be honest, I am not a python guy ! But I heard over the official #alfresco IRC channel that cmislib is not so much of an active project, and questions about it only bump once in a while .... The RESTful api however may be considered as a good alternative in your use case:
To access alfresco content using the RESTful api, you should be querying this webscript: /alfresco/d/<d|a>/<workspace>/<store>/<nodeId>/<filename>
where :
d and a refer to direct / attached mode
<workspace>, <store> and <nodeId> reference your content nodeRef
<filename> a file name of your choice
So you should be making a GET Request an a URL that looks something like this http://<host>:<port>/alfresco/d/d/workspace/SpacesStore/8444ad61-4734-40e3-b2d4-b8b1c81347fd/myFile.ext
Note : Depending on the permission set on your node, you might need to attach an alf_ticket to the URL for an authenticated alfresco user. Please check this for further insights.
UPDATE 1:
If you have a problem identifying your file nodeRef, then you can setup a repo webscript implementing your custom logic (browsing some folder / searching for a document by name or metadata ....)
If your are not familiar with webscript development check Jeff Pott's tutorial on the subject
UPDATE 2:
To get started with your webscript development check out Alfresco docs/wiki!
Check this wiki page to learn how to retrieve children for a given node !
Or check this wiki page to learn how to develop webscripts implementing your custom business logic.
If you do not have anything against the YUI javascript library (that is no longer actively maintained), you can integrate the object-finder already available in Alfresco Share. The library is in
share/components/object-finder/object-finder.js
You will need to modify it a bit given that you are not inside Share.
To be totally honest, I do not know if it is feasible because it has other dependencies but being a browser site library, in theory can be integrated everywhere.

Django - Flickr feed without sync

I want to show the latest 8 images from a Flickr photostream using Django. I've had a good google and the only articles I can find focus on syncing the results with a database. I'd rather not do this if possible, I just want to show the images and nothing else.
http://code.djangoproject.com/wiki/FlickrIntegration This page has some adaptable code, but the library he uses seems to be offline now.
Does anyone have any examples of how I might integrate with a flickr stream without syncing the results?
Why can't you just use the flickr API from Python? There's probably python packages to do it. All you do is get the user's photostream info, map the photos to URLS:
http://www.flickr.com/services/api/flickr.people.getPhotos.html
Then your Django template just has an <img> tag with the right URL.
Edit: python packages listed on the flickr API page:
http://stuvel.eu/flickrapi
http://code.google.com/p/flickrpy/
I made Flickr Pony for use Flickr with Django Storage API and more.
You'll only need an API KEY and launch this:
>>> from flickr_pony.storage import FlickrStorage
>>> storage = FlickrStorage(api_key="myApiKey")
>>> storage.listdir('140893176#N07')
([], ['https://farm2.staticflickr.com/1586/25309081103_518e989396_o.jpg',
'https://farm2.staticflickr.com/1623/25911906696_84c8cf31ae_o.jpg',
'https://farm2.staticflickr.com/1617/25637193860_98a08d224f_o.jpg',
...
'https://farm2.staticflickr.com/1671/25794942526_5b54c8a908_o.jpg',
'https://farm2.staticflickr.com/1653/25820730145_4040532d03_o.jpg'])