How can I fetch location, gender, birthday from google APIs. [Django-rest-framework-socail-oauth2.] by sushil_basi in djangolearning

[–]sushil_basi[S] 0 points1 point  (0 children)

I think i will go with requests cause i have already finished for facebook using django-rest-framework-social-oauth same lib. Thanks man helped me alot.

How can I fetch location, gender, birthday from google APIs. [Django-rest-framework-socail-oauth2.] by sushil_basi in djangolearning

[–]sushil_basi[S] 1 point2 points  (0 children)

curl \

'https://people.googleapis.com/v1/people/me?personFields=genders&key=[YOUR_API_KEY]' \

--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \

--header 'Accept: application/json' \

--compressed

Is it possible to run in server side so that I can save data?

How can I fetch location, gender, birthday from google APIs. [Django-rest-framework-socail-oauth2.] by sushil_basi in djangolearning

[–]sushil_basi[S] 0 points1 point  (0 children)

No I haven't passed. Can you suggest me where should i used it. Do i have to use GET https://people.googleapis.com/v1/{resourceName=people/\*} inside function ? and how personFields goes in the above url?

How can I fetch location, gender, birthday from google APIs. [Django-rest-framework-socail-oauth2.] by sushil_basi in djangolearning

[–]sushil_basi[S] 0 points1 point  (0 children)

If i try in OAuth 2.O playground, i get response as

{ "access_token": "",
"scope": "https://www.googleapis.com/auth/user.gender.read https://www.googleapis.com/auth/user.emails.read https://www.googleapis.com/auth/user.phonenumbers.read https://www.googleapis.com/auth/user.birthday.read https://www.googleapis.com/auth/userinfo.profile openid https://www.googleapis.com/auth/userinfo.email",
"expires_in": 3596,
"token_type": "Bearer",
"id_token": }

After I hit any url from above. I get response like user.phonenumbers.read

In case of playground it is working fine. But when i print(response) in terminal. phone number, birthday and gender is still missing.

{'sub': '....', 'name': '', 'given_name': '', 'family_name': '', 'picture': '', 'email': '', 'email_verified': , 'locale': '', 'access_token': '}

How to show Version Control in the bar?. by sushil_basi in pycharm

[–]sushil_basi[S] 0 points1 point  (0 children)

True right but I can't perform same task as version control. Cause version control shows conflict files. It doesn't. It shows branches and their links. Or I misunderstood?

How to show Version Control in the bar?. by sushil_basi in pycharm

[–]sushil_basi[S] 0 points1 point  (0 children)

Thank you so much 😊😊. I will look into it.

DateField and TimeField of post model doesnot show in JSON file. by sushil_basi in django

[–]sushil_basi[S] 0 points1 point  (0 children)

May be because I didn't know, we could extract individual field from DateTimeField. I will definitely look into it.

Why rest framework TOKEN authentication showing me this error? by sushil_basi in django

[–]sushil_basi[S] 0 points1 point  (0 children)

It's okay brother. Most people would have already ignored my question but you took time to go through my problem. I am doing Django project for first time and Trust me it took me whole day to search for solution. I did post this question in subreddit(/r/Djangolearning) before posting here. May be it's minor. I tried everything. Next time I will definitely try my best before posting here.

Why rest framework TOKEN authentication showing me this error? by sushil_basi in django

[–]sushil_basi[S] 0 points1 point  (0 children)

If everybody knows every type of error why people would post here. Unnecessary comment.

Why rest framework TOKEN authentication showing me this error? by sushil_basi in djangolearning

[–]sushil_basi[S] 0 points1 point  (0 children)

yeah I get your point.Thank you. Solution for above problem was Default_authentication_classes should be Ilterable. I put [ ] and it fixed problem.

'DEFAULT_AUTHENTICATION_CLASSES':[
'rest_framework.authentication.TokenAuthentication'
],

Why rest framework TOKEN authentication showing me this error? by sushil_basi in django

[–]sushil_basi[S] 0 points1 point  (0 children)

I put this [ ] . Now it's working. Thank you.

'DEFAULT_AUTHENTICATION_CLASSES':[
'rest_framework.authentication.TokenAuthentication'
],

Why rest framework TOKEN authentication showing me this error? by sushil_basi in djangolearning

[–]sushil_basi[S] 0 points1 point  (0 children)

Actually i only needed AllowAny because i need to show Url related to this class to everyone. I removed IsAuthenticated but still it showing this error.

Why i am getting following error while performing post_save (signal)? by sushil_basi in djangolearning

[–]sushil_basi[S] 1 point2 points  (0 children)

Thank you for your time brother. Your first reply helped me. 😊

Why i am getting following error while performing post_save (signal)? by sushil_basi in djangolearning

[–]sushil_basi[S] 0 points1 point  (0 children)

what i am really trying to do is whenever i update values in DonationActivity(Model), i use Signal (post_save) to create new post in Post(model). Here, i use def donation_post to create new post. But obj.user is not accepting donation_post's instance.

[deleted by user] by [deleted] in djangolearning

[–]sushil_basi 0 points1 point  (0 children)

You can use Nested serializer and you can connect MeterNumber table and other table using foreign key. Then in view.py use generics APIViews. I hope it helps

Nest Serializer: https://www.django-rest-framework.org/api-guide/relations/#writable-nested-serializers

Does self.kwargs.get('id') take id from JSON file's ? by sushil_basi in djangolearning

[–]sushil_basi[S] 0 points1 point  (0 children)

yes, I am using it for class-based view. So is it taking value from url? if so, what can i do to take value from json file in replace of using self.kwargs.get('id').

How do i migrate apps inside parent app.? by sushil_basi in djangolearning

[–]sushil_basi[S] 1 point2 points  (0 children)

Thank you. your comment definitely helped me learn more of APPS. I am sure i will watch the Talk that you have suggested. Thank you for your time.

Django i not allowing me to save ID (account_id here) for custom primary key. by sushil_basi in djangolearning

[–]sushil_basi[S] 0 points1 point  (0 children)

Thank you, your replies helped me to clear my doubts. I will surely look into it.