Skip to content

Instantly share code, notes, and snippets.

View hassanabidpk's full-sized avatar
🎯
Focusing

Hassan Abid hassanabidpk

🎯
Focusing
  • Singapore
View GitHub Profile
from django.contrib.auth.models import User, Group
from rest_framework import serializers
from .models import Location,Restaurant
class UserSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = User
fields = ('url', 'username', 'email', 'groups')
Common Endpoints
  • Get list of all restaurants: /api/v1/
  • Get list of restaurants for particular location and type: /api/v1/ with params location and rtype
  • Sample Request: https://searchrestaurant.pythonanywhere.com/api/v1/?format=json&location=oslo&rtype=pizza
Response Values
  • In case of error you will get an error key with a status code
  • You will get an array of dicts eaching containing information about place(restaurant,coffee shop etc.)
@hassanabidpk
hassanabidpk / sujinlee_weather_yahoo.py
Created November 29, 2015 14:29 — forked from allieus/sujinlee_weather_yahoo.py
이수진님 날씨 스크립트 개선
# https://github.com/sujinleeme/my-python-journey/blob/master/PR4E/yahoo-weatherAPI.py
import requests
def get_weather(city):
baseurl = 'https://query.yahooapis.com/v1/public/yql'
yql_query = "SELECT * FROM weather.forecast WHERE woeid IN (SELECT woeid FROM geo.places(1) WHERE text='%s')" % city
params = {'q': yql_query, 'format': 'json'}
data = requests.get(baseurl, params=params).json()
@hassanabidpk
hassanabidpk / CursorRecyclerViewAdapter.java
Last active September 22, 2015 07:20 — forked from skyfishjy/CursorRecyclerViewAdapter.java
CursorRecyclerViewAdapter
/*
* Copyright (C) 2014 skyfish.jy@gmail.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
DjangoGirls - how we scored applications?
지원자 점수제에 대하여
각 지원자에 대하여 1점부터 5점까지 점수를 매겼습니다.
점수 부여 대상 항목은 다음과 같습니다.
• 워크샵 내용이 지원자에게 어떤 실질적인 이득을 주는가?
• 워크샵 내용을 가지고 지원자가 추후 다른 사람들에게 어떤 (현실적인) 도움을 줄 수 있는가?
// These two need to be declared outside the try/catch
// so that they can be closed in the finally block.
HttpURLConnection urlConnection = null;
BufferedReader reader = null;
// Will contain the raw JSON response as a string.
String forecastJsonStr = null;
try {
// Construct the URL for the OpenWeatherMap query
composer.json
-------------
{
"require": {
"facebook/php-sdk" : "*"
}
}
Phalcon Bootstrap index.php