Ver código fonte

instagram.py: created function get_user_media() that handles getting recent media from user

mk200789 10 anos atrás
pai
commit
e756fc30ac

+ 2 - 0
angular/index.html

@@ -27,12 +27,14 @@
         <script src="scripts/controllers/githubUserController.js"></script>
         <script src="scripts/controllers/githubTopContributionsController.js"></script>
         <script src="scripts/controllers/steamSalesController.js"></script>
+        <script src="scripts/controllers/instagramUserController.js"></script>
 
         <!-- Factories -->
         <script src="scripts/factories/restAppFactory.js"></script>
         <script src="scripts/factories/githubUserFactory.js"></script>
         <script src="scripts/factories/githubTopContributionsFactory.js"></script>
         <script src="scripts/factories/steamSalesFactory.js"></script>
+        <script src="scripts/factories/instagramUserFactory.js"></script>
 
     </head>
 

+ 6 - 1
hackathon_starter/hackathon/scripts/instagram.py

@@ -65,4 +65,9 @@ class InstagramOauthClient(object):
 		data = content['data']
 		return data
 
-
+	def get_user_media(self, access_token):
+		user_media = 'https://api.instagram.com/v1/users/32833691/media/recent/?access_token='+access_token
+		req = requests.get(user_media)
+		content = json2.loads(req.content)
+		data = content['data']
+		return data

+ 0 - 1
hackathon_starter/hackathon/templates/hackathon/instagram.html

@@ -4,7 +4,6 @@
 	{% include 'hackathon/base.html' %}
 	<h1 class="text-center"> {{ title }}</h1> 
 	<br>
-	<div class="col-lg-12">
 		<div class="table-responsive">
 			<h2> #{{search_tag}} </h2>
 			<table class="table">

+ 0 - 1
hackathon_starter/hackathon/views.py

@@ -195,7 +195,6 @@ def instagramUser(request):
     parsedData = getInstagram.get_user_info(access_token)
     return JsonResponse({ 'data': parsedData })
 
-
 ##################
 #  LINKED IN API #
 ##################