I want to store information for every request made to my site. For example USER_AGENT etc. Like google analytics do. And then I want to expose that information using rest-API. Is their any APP for this.???
Related
This question may be super simple but I've been googling for a while now and haven't found an exact solution.
I'm trying to implement a Google Login using React for the frontend and Django for the backend.
How exactly would I do this? I have seen solutions where a token is sent over to the backend which then retrieves the necessary information from the Google API and either creates or retrieves a user from the database based on the token. However, this seemed to be based on JWT and I was wondering if it is possible to implement the same with the simple Django Auth Token?
Maybe I'm just really blind but I really wasn't able to find a suitable solution.
Thanks for your help!
I was actually working on this a few moments ago, after many fails in the past. It's quite a headache really trying to find a solution that works with React. I have however managed to easily setup google login on the React front end side with https://www.npmjs.com/package/react-google-login. This should be the first step you will need to take.
After that you will need to setup social login on the Django backend using django_allauth. Basically, the idea is once a user logs in via google or to be precise, clicks on the Login With Google button on the front end, a google access_token will be retrieved from Google and saved in local storage together with some other data. Only the access_token is of interest here. So you will then need to take this access_token and send it to the Django backend via a Rest API of a view that you will have setup. That will get the google user data saved in the database under social accounts, ultimately login them in the application. Everything from then on should continue as per your normal logins with email and username. That is if using JWT, a jwt token will be returned from the backend which you hopefully should be able to save in local storage. In my React app, I authenticate against this token, so as long as I have the token in local storage, a user is logged in.
Pratik Singh Chauhan does a good job explaining this in his Part 1 tutorial here -> https://medium.com/#pratique/social-login-with-react-and-django-i-c380fe8982e2 and Part 2 here -> https://medium.com/#pratique/social-login-with-react-and-django-ii-39b8aa20cd27
UPDATE: June 2022
Since Google is now moving to (GIS) Google Identity Services sign-in SDK, this method, although it works is now deprecated.
Here is a good link to help you setup react login with the new google GIS.
https://github.com/MomenSherif/react-oauth/issues/12#issuecomment-1131408898
There are 2 methods you can use depending on your workflow, implicit or authorization. To maintain a similar workflow that the above code achieved, implicit workflow is the one that can give you both access_token and refresh_token that you will send to your backend api.
Here is another link with sample code for both workflows.
https://react-oauth.vercel.app/
Note you will need to use #react-oauth/google to configure the Google workflows in your code.
Refer to this:
https://reactjsexample.com/google-oauth2-using-the-new-google-identity-services-sdk-for-react/
My question is about building and requesting a URL from a server using Python. Here specifically the eBay APIs. I want to submit the request and get the response and process the received Json in Python. I tried using the eBay Python sdk but I don't know how to use it for a price comparison sort of thing, or to get the seller information and anything else. I was able to use the finding API and get a category of products and I was able to iterate over products and get details.
I guess I could make URLs according to eBay API doc, if you can give me some examples of how it's done. I am really interested in using the new APIs, the analytics and metadata.
ebay Api Documentation
I am using qualtrics for embedding survey in my website. My requirement is to get the email from qualtrics at end of the survey and send it back to my website as a response.I have seen the web service option in qualtrics and planning to put the web service at the end of the survey flow.I have already read the documentation and noticed that we need to pass a feed url as a web service url. Please suggest a good documentation regarding this.
Note: I am using website which is running on Drupal 7.
You can use a web service to send data to and/or retrieve data from your website.
To send data from the survey to your website, you pass each piece of data as a parameter. Just as you would in a url, except Qualtrics takes care of the encoding for you.
To retrieve data from your website and store it as embedded data in your survey, the web service must format it as json or an xml feed (rss or atom).
If you only need to send and not receive data from the web service, click the fire and forget checkbox.
For general information you can look here:
http://www.qualtrics.com/university/researchsuite/advanced-building/survey-flow/web-service/
Is it possible to use data from Google Analytics when someone visits my web page?
I would like to get information about the visitor, eg:
location
how many times he visited the page
from where he comes
time spent on website
etc
And depending on those informations display proper content. Or even add them (silently) to the contact form.
Is it possible to use the data collected by Google Analytics or should I create my own mechanism based on cookies? Maybe any other solution?
This isn't possible. Universal Analytics uses a cookie with an ID for the user and handles the rest on the server, so there's no data available to you. However, all of the info that Google is tracking is accessible to you.
location you can get via the users IP
visits you can get by setting a cookie on each user and tracking sessions
referrer should be in the request headers
time spent can be tracked the same way that ga does, but keeping track of the time everytime the user creates another hit
I have a website built in Django. One feature of this website is booking hotels. Now, my client has many agents who have websites. We want to give the facility of booking on these websites. So, I am thinking to use iframe on these websites( with the consent of the respective agent owners), which will point to the booking page of our website. Once booking is done, we will return success message and email the user. IS this a viable solution? Or, are there any other options?
thanks
One way of doing this it's creating a rest api using a helper that works with django like django-piston so your agents could work with them to perform booking.
Should be easy to add a form to any agents site with this way. Or even using ajax if the uri returns a json.
Iframes is not the way you should go I think... I also think that you need to define the API on your website and then you just do requests from the client website to your backend.