hpugmeetup

meetup.com api playing

In [22]:
import requests
import json
import arrow
import time
In [ ]:
 
In [2]:
meetupevent = requests.get('https://api.meetup.com/NZPUG-Hamilton/events?photo-host=public&page=20&sig_id=58828502&sig=0dad7aaf8580ff66baa2746ded3ae6b332df7c98')
In [6]:
jsmeet = json.loads(meetupevent.text)
In [10]:
jsmeet[0]['name']
Out[10]:
'Hamilton Python Meetup'
In [12]:
jsmeet[0]['description']
Out[12]:
'<p><b>William Mckee</b> is talking about the <a href="http://docs.timdorr.apiary.io/">Tesla Model S JSON API</a> and the <a href="https://www.w3.org/TR/vehicle-information-api/">Vehicle Information Access API</a> - configuring and extending with Python.</p> <p><b>William</b> will also talk about the Python micro-framework <a href="http://flask.pocoo.org/">Flask</a> for building websites and apps. He will cover the history, basics and extensions such as flask_restful/Flask-Security/flask-jsonify. Demo of how easy it is to get started. How to use it to build and serve a RESTful API. With Flask you can build up rather than start heavy and bloated with frameworks such as <a href="https://www.djangoproject.com/">Django</a>.</p> <p><br/>Together with <b>Ian Stewart</b> we will attempt on accessing the <a href="http://www.meetup.com/meetup_api/">Meetup.com API</a> in a <a href="http://www.web2py.com/">web2py</a> test environment for displaying the next upcoming meeting.</p> <p>Also, <b>Ian Stewart</b> has been creating a <i>template methodology</i> as an approach for teaching Python to secondary school students. Ian will display and demonstrate his template code, and welcomes all feedback on this methodology and how to improve the code in his templates.</p> '
In [42]:
jsmeet[0]['venue']['name']
Out[42]:
'MS4.G.02'
In [34]:
jsmeet[0]['venue']['address_1']
Out[34]:
'University of Waikato'
In [36]:
jsmeet[0]['venue']['city']
Out[36]:
'Hamilton'
In [39]:
#jsmeet[0]['venue']
In [40]:
jsmeet[0]['venue']['localized_country_name']
Out[40]:
'New Zealand'
In [18]:
eptime = (jsmeet[0]['time'])
In [24]:
import datetime


t = datetime.datetime.fromtimestamp(float(eptime)/1000.)
In [27]:
t.weekday()
Out[27]:
0
In [28]:
t.month
Out[28]:
11
In [29]:
t.hour
Out[29]:
19
In [30]:
t.minute
Out[30]:
0
In [31]:
t.day
Out[31]:
14
In [23]:
time.gmtime(eptime)
---------------------------------------------------------------------------
OverflowError                             Traceback (most recent call last)
<ipython-input-23-0d2bd71bab67> in <module>()
----> 1 time.gmtime(eptime)

OverflowError: timestamp out of range for platform time_t
In [20]:
meetime = arrow.get(eptime)
---------------------------------------------------------------------------
OverflowError                             Traceback (most recent call last)
<ipython-input-20-07d00d3f76e2> in <module>()
----> 1 meetime = arrow.get(eptime)

/usr/local/lib/python3.4/dist-packages/arrow/api.py in get(*args, **kwargs)
     21     '''
     22 
---> 23     return _factory.get(*args, **kwargs)
     24 
     25 def utcnow():

/usr/local/lib/python3.4/dist-packages/arrow/factory.py in get(self, *args, **kwargs)
    142             # try (int, float, str(int), str(float)) -> utc, from timestamp.
    143             if is_timestamp(arg):
--> 144                 return self.type.utcfromtimestamp(arg)
    145 
    146             # (Arrow) -> from the object's datetime.

/usr/local/lib/python3.4/dist-packages/arrow/arrow.py in utcfromtimestamp(cls, timestamp)
    111 
    112         timestamp = cls._get_timestamp_from_input(timestamp)
--> 113         dt = datetime.utcfromtimestamp(timestamp)
    114 
    115         return cls(dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second,

OverflowError: timestamp out of range for platform time_t
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 

Comments

Comments powered by Disqus