Django 3rd party image uploading service from browser - django

HiI want users to be able to upload their own photos from the browser, but I read that it isn't safe to let them upload files to your server without many protections. I need a image hosting website that has an easy API for uploading photos (for free).
The only one I have found is Cloudinary, which is awesome, but following their tutorial didn't work. I guess the reason is it's outdated, and I'm using Django 1.10...
If there is a way of doing so, even without a special API, (by sending requests to some image hosting site) I would like to give it a try as well.
Thanks in advance!

If you are creating a non-commercial application, you might want to check out Imgur. Their API is free for open-source applications and non-commercial applications.
A note from their official API page: Each application can allow approximately 1,250 uploads per day or approximately 12,500 requests per day.

Related

Build a website in sitecore and make it offline

I want build site using Sitecore(7.2) and also make it offline. Our requirement is not to use headless CMS. Is there any way to build or make it offline?
Internet websites cannot be delivered 'offline' without having all possible data delivered to the device so that it no longer needs to connect to the internet. This sounds less like a website, and more like an app that somebody would install?
If so, you probably DO need to look at headless and building an app that connects to the APIs for updates.
You might need to be more specific about the business use case because it seems contradictory to want to use a web application software that delivers web content, without using headless, and works without the web.
As already suggested that internet websites cannot work offline so either you have an app or intranet website.
Considering as an app you can consume sitecore OData apis for Content/Media however it will not work for Presentations and you have to implement your own mobile designs based on Xamarin or native.
For odata related information you can refer below link:
https://doc.sitecore.com/developers/90/sitecore-experience-manager/en/the-odata-item-service.html
Once you get the response from api, you can locally store it in your local db of app

How to use Google APIs to reduce in memory usage and to use Advance Google features?

I want to build a system that would allow users to POST videos to their YouTube channel after they are logged in with the google account to my website. The video will be published on the website.
After that, I also need that the users could comment on the videos that showed on my website, and on YouTube.
After that, I need that the user's profile pictures will be uploaded to their own Google Drive.
Tasks:
Upload Videos to the website with Youtube (Youtube Video API).
Comment on videos on the website (Youtube Comments API).
Upload profile picture to Google Drive (Google Drive API).
I don't know where to start, and how to do that any user "Hosts" itself, for example, he can add videos, comments, and host his profile picture.
Using Django with Python3
Welcome to Stackoverflow! I hope you have a great time here. I have to warn you, however, that the question you are asking is off the site's guidelines. You should limit the scope of your question to one single problem that are you are facing. I suggest you read more about this here.
I recommend you to tackle one of the tasks first (such as the Google Drive one). You can follow this comprehensive quickstart provided by Google itself, which will allow you to write a script that lists the files on your Google Drive instance. Afterwards, you may try to upload files (your profile pictures) to it, following this piece of documentation which also includes Python examples.
Further to that, I also recommend that you check out the following links:
This explanation about how OAuth2 works, and more specifically with Google APIs.
Documentation on how to use the Google API Client library for Python.
Django social auth, a plugin for Django that allows your users to log into your platform using their Google credentials.
I hope this is useful to you and that you manage to build a great application.

What is the recommended way to handle large file uploads to s3?

I'm using AWS SDK for Ruby to upload large files from users to s3.
The server is a sinatra app with a POST /images endpoint accepting multipart/form-data. I'm experiencing a noticeable delay with user uploads. This is to be expected, because it's making a request to s3 synchronously. I wanted to move this to a background job using something like Sidekiq, but I'm not sure I like that solution.
I read online that some people are promoting direct uploads to s3 on the client side. Some even called this a "best practice." I'm hesitant to do this for several reasons:
My client side code would be heavily tied down to my cloud provider. I love AWS (great experiences), but I like to remain somewhat cloud-agnostic. I don't want my mobile and web apps to have to know the details of my AWS setup. If I choose to move away from s3 at a later date (unlikely but plausible), I would want this to be a seamless transition. Obviously, this works ok for a web app, because I can always redeploy quickly. However, I have to worry about mobile. Users may not update, and everything will become a lot more complicated if some users are uploading to s3 and some are uploading to another service.
Business logic regarding determining which bucket and region to use would need to either exist on the client side or I'd need to expose an endpoint for determining which bucket and region to use for each user. Then, I'd have to make a request to my server to figure out the parameters before I can begin uploading to s3. I want to be able to change buckets or re-route users to alternative regions and so I'm not a fan of this tight coupling or the additional request.
Security is a huge concern. When files are uploaded and processed through my server, I can utilize AWS IAM to properly ensure that these files are only coming from my server. I believe that I have to grant an "all-write" privilege to users which is problematic. If I use AWS IAM credentials in JavaScript, I do not see how you can ensure that users do not get unlimited write access to my bucket. All client side javascript, can be read by a user. In addition, I'm unaware of how to process validations. On my server, I can scan the files and determine whether or not to upload to s3. If I upload directly from the client, I would have to move this processing into lambda functions. I'm ok with that, but there is a chance the object could be retrieved by users before the processing has occurred. Then, I'd have to build some sort of locking system to prevent access before processing.
So, the bottom line is I have no idea where to go from here. I've hacked around some solutions, but I'm not thrilled with any of them. I'd love to learn how other startups and enterprises are tackling this kind of problem. What would you recommend? How would you counter my argument? Forgive me if I'm missing something, I'm still relatively an AWS-newbie.
If you're worried about changing the post service I would suggest using an API and that way you can change the backed storage for your service. The mobile or web client would call the service and then your api would place the file where it needed to go. The api you have more control over and you could just created a signed s3 url to send to the client and let them still do the uploading.
An api, like in 1, solves this problem too, the client doesn't have to do all the work.
Use Simple Token Services and Temporary Security Credentials.
I agree with strongjz, you should use an API to upload your files from the server side.
Cloudinary provides an API for uploading images and videos to the cloud.
From what I know from my experience in using Cloudinary it is the right solution for you.
All your images, videos and required metadata are stored and managed by Cloudinary in Amazon S3 buckets owned by Cloudinary.
The default maximum file size limit for videos is 40MB. This can be customized for paid plans.
For example in Ruby:
Cloudinary::Uploader.upload("sample_spreadsheet.xls", :resource_type =>
:raw)

Can I use a 3rd party video content portal like youtube to upload and post videos on my own web portal?

I manage a website where users post entertainment content (photos, text). It's developed in Django with postgresql. I am trying to add a video feature on the website - such that everyone can upload their favorite videos on the website and share them.
Instead of building out video streaming infrastructure myself, can I use an existing video service as a viable backend? For instance, using Youtube's API to send all uploaded videos to its servers, and then embed a youtube player in my website that users can utilize to view uploaded videos? Youtube actually imposes a quota, that computes to about 400 video uploads, 1500 write operations, and 50,000 read operations. My website's scale is already beyond this. Are there any other services I can use? Sorry if this is a newbie question, I actually don't have any experience in this domain. If you point me in the right direction, perhaps giving an illustrative example, I can start getting deeper into this.
The closest I have gotten is getting a bizspark plus subscription that is free for one and a half years. After that one can use Azure media services to get the job done.

Amazon products API - Looking for basic overview and information

After using the ebay API recently, I was expecting it to be as simple to request info from Amazon, but it seems not...
There does not seem to be a good webpage which explains the basics. For starters, what is the service called? The old name has been dropped I think, and the acronym AWS used everywhere (but isn't that an umbrella term which includes their cloud computing and 20 other services too?).
There is a lack of clear information about the new 'signature' process. Gathering together snippets of detail from various pages I've stumbled upon, it seems that prior to August 2009 you just needed a developer account with Amazon to make requests and get XML back. Now you have to use some fancy encryption process to create an extra number in your querystring. Does this mean Amazon data is completely out of reach for the programmer who just wants a quick and simple solution?
There seems to be a tiny bit of information on RSS feeds, and you can get a feed of items that have been 'tagged' easily, but I can't tell if there is a way to search for titles using RSS too. Some websites seem to suggest this, but I think they are out of date now?
If anyone can give a short summary to the current state of play I'd be very grateful. All I want to do is go from a book title in my database, and use Classic ASP to get a set of products that match from Amazon, listing cover images and prices.
Amazon 'widgets' can display keyword search results on my pages, but I have less control over these, and they are shown to the user only - my code can't look inside them.
Your post contains several questions, so I'll try to answer them one at a time:
The API you're interested in is the Product Advertising API (PA). It allows you programmatic access to search and retrieve product information from Amazon's catalog. If you're having trouble finding information on the API, that's because the web service has undergone two name changes in recent history: it was also known as ECS and AAWS.
The signature process you're referring to is the same HMAC signature that all of the other AWS services use for authentication. All that's required to sign your requests to the Product Advertising API is a function to compute a SHA-1 hash and and AWS developer key. For more information, see the section of the developer documentation on signing requests.
As far as I know, there is no support for retrieving RSS feeds of products or tags through PA. If anyone has information suggesting otherwise, please correct me.
Either the REST or SOAP APIs should make your use case very straight forward. Amazon provides a fairly basic "getting started" guide available here. As well, you can view the complete API developer documentation here.
Although the documentation is a little hard to find (likely due to all the name changes), the PA API is very well documented and rather elegant. With a modicum of elbow grease and some previous experience in calling out to web services, you shouldn't have any trouble getting the information you need from the API.
I agree that Amazon appears to be intentionally obfuscating even how to find the API documentation, as well as use it. I'm just speculating though.
Renaming the services from "ECS" to "Product Advertising API" was probably also not the best move, it essentially invalidated all that Google mojo they had built up over time.
It took me quite a while to 'discover' this updated link for the Product Advertising API. I don't remember being able to easily discover it through the typical 'Developer' link on the Amazon webpage. This documentation appears to valid and what I've worked from recently.
The change to authentication procedures also seems to add further complexity, but I'm sure they have a reason for it.
I use SOAP via C# to communicate with Amazon Product API.
With the REST API you have to encrypt
the whole URL in a fairly specific
way. The params have to be sorted,
etc. There is just more to do. With
the SOAP API, you just encrypt the
operation+timestamp, and thats it.
Adam O'Neil's post here, How to get album, dvd, and blueray cover art from Amazon, walks through the SOAP with C# method. Its not the original sample I pulled down, and contrary to his comment, it was not an official Amazon sample I stumbled on, though the code looks identical. However, Adam does a good job at presenting all the necessary steps. I wish I could credit the original author.
I wrote a blog post on this subject, after spending hours wading through Amazon's obscure documentation. Maybe useful as another view on the process.
I found a good alternative for requesting amazon product information here: http://api-doc.axesso.de/
Its an free rest api which return alle relevant information related to the requested product.
Some links i found:
Forum thread for amazon tutorial request
Amazon Web Services
Some sort of script for using the amazon eCommerce API
another tutorial for amazon web-store-y stuff
Amazon and ebay e-commerce API tutorials
Straight from the horse's moutyh: Summary of Product Advertising API Operations which has the following categories:
Find Items
Find Out More About Specific Items
Shopping Cart
Customer Content
Seller Information
Other Operations
Since the time when the question was asked in 2009 the changes have, unsurprisingly, continued and some of the answers and links provided are now superseded or deadlinks.
As of February 2022, Amazon now provide the Product Advertising API Scratchpad for developers to try out API requests so they can get up and running in minutes:
Scratchpad is a tool to help Amazon Associates send basic requests to
the Product Advertising API. Follow the steps below and you can have a
working request with sample code in minutes.
The linked page also has onward links to pages where you may
sign up for the Associate program and Product Advertising API and access the complete API documentation.
As mentioned by #Reg Edit in his recent answer, Amazon now provides a scratchpad for their Product Advertising API, which in-fact does have a "SearchItems" endpoint which presumably returns products for a search query similar to the one a shopper would enter into Amazon's search bar while shopping.
Here's a link explaining on how to get access to Amazon's Product Advertising API. This would be helpful for anyone looking to display Amazon product's on their application programmatically.
In order to get access to Amazon's Product Advertising API, you must meet the following 3 requirements:
Have completed 3 sales in the last 180 days
Have an approved associates account
Comply with this agreement
Now if you don't meet the above requirements, the only other option Amazon gives you is to use their SiteStripe widget, which is a tool to help associates build links manually.
If you do not meet the requirements listed above and would still like to get Amazon product data for your app or website programmatically, you may use web scraping to achieve the same. Since the data is public, no one can legally stop you from scraping it. Depending on how experienced you are with programming, you could either build a scraper yourself or use a service that enables you to do so.
I have built one such service myself—it is called Amazon Product Search API and it allows users to grab search results from Amazon including product title, thumbnail, URL, etc. for any search query a user would make while shopping on Amazon. It supports all the major countries Amazon operates in.
Using this service does not require you to be an Amazon associate. Users may scrape up to 10k search results for free.