SLCPython / old.slcpy.com

Official Repo of SLCPython's website
MIT License
5 stars 8 forks source link

Including Meetup data with django-meetup or AngularJS? #6

Closed earthastronaut closed 9 years ago

earthastronaut commented 9 years ago

This question involves how we want to display data from Meetup.com on our webpage.

I included meetup data by creating a django-app which syncs information from api.meetup.com to a local database which can then be used in views. (this can also be used to edit meetup.com data but not yet)

I've just been trying out some AngularJS and realizing it may be better to query api.meetup.com using js and display the results that way.

I'm not sure, still new to web devo. Use django-app or AngularJS?

JoeReis commented 9 years ago

Js call is easiest. Do a get request.

No need to persist Meetup's data in our db.

On Tuesday, September 23, 2014, astrodsg notifications@github.com wrote:

This question involves how we want to display data from Meetup.com on our webpage.

I included meetup data by creating a django-app which syncs information from api.meetup.com to a local database which can then be used in views. (this can also be used to edit meetup.com data but not yet)

I've just been trying out some AngularJS and realizing it may be better to query api.meetup.com using js and display the results that way.

I'm not sure, still new to web devo. Use django-app or AngularJS?

— Reply to this email directly or view it on GitHub https://github.com/SLCPython/slcpy.com/issues/6.

Sent from iPhone

earthastronaut commented 9 years ago

The js get request is causing some problems. First: I had to create a signed url request because the api key needs to be kept private (that's fine though). Second: I keep getting an error "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource" in firefox. I did some google sluthing and most say I need to change server side settings but I'm not sure exactly how.

I could make all the requests using python/django api similar to what I have been doing but without creating a local database.

Below is a script I've been using to test

<!DOCTYPE html>
<html lang="en">
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<head>
    <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
    <meta content="utf-8" http-equiv="encoding">
</head>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<body> 
    <h2>Events</h2>
    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->    
    <div data-ng-app="" data-ng-controller="meetupEventsController">
    <section data-ng-repeat="ev in events">
        <h2><strong>{{ ev.status | uppercase }} Event :</strong> <a href="{{ ev.event_url }}">{{ ev.name }}</a></h2>
        <ul>
            <li><strong> When: {{ ev.time | date:'EEEE MMMM dd' }} at {{ ev.time | date:'h' }}</strong></li>            
            <li data-ng-if="ev.hasOwnProperty('venue')">
                <strong>Where: {{ ev.venue.name }}</strong>
            </li>
        </ul>
        {{ ev.description }}                 
        </br>
    </section>
    </div>
    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js"></script>
    <script>    
        function meetupEventsController($scope,$http) {
            $http.get("http://api.meetup.com/2/events?group_id=12004972&status=upcoming&order=time&limited_events=False&desc=false&offset=0&photo-host=public&format=json&page=20&fields=&sig_id=129898942&sig=639f1a755248e0e249172c74d0b9d355b5e6e787")
            .success( function(response) {
                $scope.events = response.results;        
                }
            );
        }    
    </script>
</body>
</html>
JoeReis commented 9 years ago

I should've ask what you're using Angular for. At any rate, fetching json with Python is easy. Just load it into your view and parse/call the desired variables. Then render in a template.

http://stackoverflow.com/questions/2817481/how-do-i-request-and-process-json-with-python

On Wednesday, September 24, 2014, astrodsg notifications@github.com wrote:

The js get request is causing some problems. First: I had to create a signed url request because the api key needs to be kept private (that's fine though). Second: I keep getting an error "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource" in firefox. I did some google sluthing and most say I need to change server side settings but I'm not sure exactly how.

I could make all the requests using python/django api https://github.com/meetup/python-api-client similar to what I have been doing but without creating a local database.

Below is a script I've been using to test

<!DOCTYPE html>

Events

{{ ev.status | uppercase }} Event : {{ ev.name }}

  • When: {{ ev.time | date:'EEEE MMMM dd' }} at {{ ev.time | date:'h' }}
  • Where: {{ ev.venue.name }}
{{ ev.description }}

— Reply to this email directly or view it on GitHub https://github.com/SLCPython/slcpy.com/issues/6#issuecomment-56773896.

Sent from iPhone

JoeReis commented 9 years ago

Or create a module that handles json, for reuse elsewhere and to keep that logic separate from the controller.

On Thursday, September 25, 2014, Joseph Reis josephreis@gmail.com wrote:

I should've ask what you're using Angular for. At any rate, fetching json with Python is easy. Just load it into your view and parse/call the desired variables. Then render in a template.

http://stackoverflow.com/questions/2817481/how-do-i-request-and-process-json-with-python

On Wednesday, September 24, 2014, astrodsg <notifications@github.com javascript:_e(%7B%7D,'cvml','notifications@github.com');> wrote:

The js get request is causing some problems. First: I had to create a signed url request because the api key needs to be kept private (that's fine though). Second: I keep getting an error "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource" in firefox. I did some google sluthing and most say I need to change server side settings but I'm not sure exactly how.

I could make all the requests using python/django api https://github.com/meetup/python-api-client similar to what I have been doing but without creating a local database.

Below is a script I've been using to test

<!DOCTYPE html>

Events

{{ ev.status | uppercase }} Event : {{ ev.name }}

  • When: {{ ev.time | date:'EEEE MMMM dd' }} at {{ ev.time | date:'h' }}
  • Where: {{ ev.venue.name }}
{{ ev.description }}

— Reply to this email directly or view it on GitHub https://github.com/SLCPython/slcpy.com/issues/6#issuecomment-56773896.

Sent from iPhone

Sent from iPhone

earthastronaut commented 9 years ago

Sounds good.

I'm also thinking of scraping the discussion boards of each event looking for etherpad links and posting them in an apparent way. I could do this with each request. Though it may be better to cache the information, true? That was part of having our local database. Though having a full database of meetup.com data does still seem like trying to roast a marshmallow with a blow-torch: probably an easier way.

Maybe creating a model that just links the meetup event_id with the notes?