コード例 #1
0
def init_client(raise_config_error=False):
  if conf.API_KEY and conf.API_SECRET:
      return stream.connect(conf.API_KEY, conf.API_SECRET, location=conf.LOCATION, timeout=conf.TIMEOUT)
  elif os.environ.get('STREAM_URL') is not None:
      return stream.connect()
  elif raise_config_error:
      raise ImproperlyConfigured('Stream credentials are not set in your settings')
コード例 #2
0
 def test_location_support(self):
     client = stream.connect('a', 'b', 'c', location='us-east')
     full_location = 'https://us-east-api.getstream.io/api/'
     self.assertEqual(client.location, 'us-east')
     self.assertEqual(client.base_url, full_location)
     # test a wrong location
     client = stream.connect('a', 'b', 'c', location='nonexistant')
     def get_feed():
         client.feed('user', '1').get()
     self.assertRaises(ConnectionError, get_feed)
コード例 #3
0
ファイル: tests.py プロジェクト: Aigeruth/stream-python
 def test_location_support(self):
     client = stream.connect('a', 'b', 'c', location='us-east')
     full_location = 'https://us-east-api.getstream.io/api/'
     self.assertEqual(client.location, 'us-east')
     self.assertEqual(client.base_url, full_location)
     # test a wrong location
     client = stream.connect('a', 'b', 'c', location='nonexistant')
     def get_feed():
         client.feed('user', '1').get()
     self.assertRaises(ConnectionError, get_feed)
コード例 #4
0
ファイル: tests.py プロジェクト: Aigeruth/stream-python
def connect_debug():
    return stream.connect(
        'ahj2ndz7gsan',
        'gthc2t9gh7pzq52f6cky8w4r4up9dr6rju9w3fjgmkv6cdvvav2ufe5fv7e2r9qy',
        location='us-east',
        timeout=10
    )
コード例 #5
0
ファイル: views.py プロジェクト: sibis/django-calcapp
def value_storage(request):
	resp = {"success":False, "msgs":['Cannot store the current operation.']}
	
	if request.method == 'POST':
		user_name = request.POST['name']
		memory_value = request.POST['memory_value']
		results_value = request.POST['results_value']
		a = Calculations(name=user_name,operations=memory_value,result=results_value)
		a.save()
		client = stream.connect('tzn84uddddhm', 'hd722ggruc6s6qjzrdskywtctug63r2h396yjhamrbe72cztqgnmkzzvzmh3dzv9', location='eu-central')
		

		# Create a bit more complex activity
		user_feed_1 = client.feed('user', '1')
		activity_data = {'actor': '1', 'verb': 'run', 'object': 'test',
		    'participants': ['Sibi'],
		    'started_at': datetime.datetime.now(),
		    'foreign_id': 'run:1'
		}
		user_feed_1.add_activity(activity_data)
		notification_feed = client.feed('user', '1')

		print memory_value
		print results_value
		print user_name
		resp = {"success":True, "msgs":['Operation has been updated']}
	return HttpResponse(json.dumps(resp))
コード例 #6
0
 def test_heroku(self):
     url = 'https://*****:*****@getstream.io/?app_id=1'
     os.environ['STREAM_URL'] = url
     client = stream.connect()
     self.assertEqual(client.api_key, 'thierry')
     self.assertEqual(client.api_secret, 'pass')
     self.assertEqual(client.app_id, '1')
コード例 #7
0
 def test_heroku_overwrite(self):
     url = 'https://*****:*****@getstream.io/?app_id=1'
     os.environ['STREAM_URL'] = url
     client = stream.connect('a', 'b', 'c')
     self.assertEqual(client.api_key, 'a')
     self.assertEqual(client.api_secret, 'b')
     self.assertEqual(client.app_id, 'c')
コード例 #8
0
ファイル: tests.py プロジェクト: kennym/stream-python
def connect_debug():
    return stream.connect(
        'gav9ygr75by3',
        '5ws2hnua79n9qga6e2dy572qdfapwgdc83853mjm3mjp66czyb2xkahbdhs98an8',
        location='us-east',
        timeout=10
    )
コード例 #9
0
 def test_heroku_overwrite(self):
     url = "https://*****:*****@getstream.io/?app_id=1"
     os.environ["STREAM_URL"] = url
     client = stream.connect("a", "b", "c")
     self.assertEqual(client.api_key, "a")
     self.assertEqual(client.api_secret, "b")
     self.assertEqual(client.app_id, "c")
コード例 #10
0
def connect_debug():
    return stream.connect(
        'q56mdvdzreye',
        'spmf6x2b2v2tqg93sfp5t393wfcxru58zm7jr3ynf7dmmndw5y8chux25hs63znf',
        location='us-east',
        timeout=10
    )
コード例 #11
0
ファイル: tests.py プロジェクト: Aigeruth/stream-python
 def test_heroku(self):
     url = 'https://*****:*****@getstream.io/?app_id=1'
     os.environ['STREAM_URL'] = url
     client = stream.connect()
     self.assertEqual(client.api_key, 'thierry')
     self.assertEqual(client.api_secret, 'pass')
     self.assertEqual(client.app_id, '1')
コード例 #12
0
 def test_heroku(self):
     url = "https://*****:*****@getstream.io/?app_id=1"
     os.environ["STREAM_URL"] = url
     client = stream.connect()
     self.assertEqual(client.api_key, "thierry")
     self.assertEqual(client.api_secret, "pass")
     self.assertEqual(client.app_id, "1")
コード例 #13
0
ファイル: tests.py プロジェクト: Aigeruth/stream-python
 def test_heroku_overwrite(self):
     url = 'https://*****:*****@getstream.io/?app_id=1'
     os.environ['STREAM_URL'] = url
     client = stream.connect('a', 'b', 'c')
     self.assertEqual(client.api_key, 'a')
     self.assertEqual(client.api_secret, 'b')
     self.assertEqual(client.app_id, 'c')
コード例 #14
0
ファイル: tests.py プロジェクト: allen-smithee/stream-python
 def test_heroku_real(self):
     url = 'https://*****:*****@getstream.io/?site=669'
     os.environ['STREAM_URL'] = url
     client = stream.connect()
     self.assertEqual(client.api_key, 'bvt88g4kvc63')
     self.assertEqual(client.api_secret, 'twc5ywfste5bm2ngqkzs7ukxk3pn96yweghjrxcmcrarnt3j4dqj3tucbhym5wfd')
     self.assertEqual(client.site_id, '669')
コード例 #15
0
 def follow(self, user):
     client = stream.connect(current_app.config['STREAM_API_KEY'], current_app.config['STREAM_SECRET'])
     user_feed = client.feed("Notifications", str(self.id))
     if not self.is_following(user):
         user_feed.follow("User", str(user.id))
         f = Follow(follower=self, followed=user)
         db.session.add(f)
         return True
コード例 #16
0
 def unfollow(self, user):
     client = stream.connect(current_app.config['STREAM_API_KEY'], current_app.config['STREAM_SECRET'])
     user_feed = client.feed("Notifications", str(self.id))
     f = self.followed.filter_by(followed_id=user.id).first()
     if f:
         user_feed.unfollow("User", str(user.id))
         db.session.delete(f)
         return True
コード例 #17
0
 def follow_collection(self, collection):
     client = stream.connect(current_app.config['STREAM_API_KEY'], current_app.config['STREAM_SECRET'])
     user_feed = client.feed("Timeline", str(self.id))
     if not self.is_following_collection(collection):
         user_feed.follow("Collections", str(collection.id))
         f = CollectionFollow(c_follower=self, following=collection)
         db.session.add(f)
         return True
コード例 #18
0
    def test_api_url_location(self):
        client = stream.connect("key", "secret", location="tokyo")
        feed_url = client.get_full_url(service_name="api", relative_url="feed/")

        if not self.local_tests:
            self.assertEqual(
                feed_url, "https://tokyo-api.stream-io-api.com/api/v1.0/feed/"
            )
コード例 #19
0
 def _connect(self):
     from dotenv import load_dotenv
     load_dotenv()
     import os
     clientid = os.getenv("clientid")
     secretid = os.getenv("secretid")
     self.client = stream.connect(clientid, secretid)
     return self.client
コード例 #20
0
    def test_location_support(self):
        client = stream.connect('a', 'b', 'c', location='us-east')

        full_location = 'https://us-east-api.getstream.io/api/'
        if self.local_tests:
            full_location = 'http://localhost:8000/api/'

        self.assertEqual(client.location, 'us-east')
        self.assertEqual(client.base_url, full_location)

        # test a wrong location, can only work on non-local test running
        if not self.local_tests:
            client = stream.connect('a', 'b', 'c', location='nonexistant')

            def get_feed():
                f = client.feed('user', '1').get()

            self.assertRaises(requests.exceptions.ConnectionError, get_feed)
コード例 #21
0
def delete_the_feed_trending():
    client = stream.connect(
        'q2hzgpctc2e5',
        'cgrx2vxsy6kmr4m76mt648azhfcucjkyev2v27au2envsgujxer3zs62fpwtm4xb')
    feed = client.feed('constantuser', 'trending')
    activities = feed.get()
    # print(activities['results'])
    for x in activities['results']:
        feed.remove_activity(x['id'])
コード例 #22
0
 def test_heroku_real(self):
     url = 'https://*****:*****@getstream.io/?app_id=669'
     os.environ['STREAM_URL'] = url
     client = stream.connect()
     self.assertEqual(client.api_key, 'bvt88g4kvc63')
     self.assertEqual(
         client.api_secret,
         'twc5ywfste5bm2ngqkzs7ukxk3pn96yweghjrxcmcrarnt3j4dqj3tucbhym5wfd')
     self.assertEqual(client.app_id, '669')
コード例 #23
0
 def unfollow_collection(self, collection):
     client = stream.connect(current_app.config['STREAM_API_KEY'], current_app.config['STREAM_SECRET'])
     user_feed = client.feed("Timeline", str(self.id))
     f = self.followed_collection.filter_by(
         collection_id=collection.id).first()
     if f:
         user_feed.unfollow("Collections", str(collection.id))
         db.session.delete(f)
         return True
コード例 #24
0
 def delete_from_stream(self):
     # Initialize client and delete activity
     try:
         client = stream.connect(current_app.config['STREAM_API_KEY'], current_app.config['STREAM_SECRET'])
         user_feed = client.feed('Collections', str(self.collection_id))
         user_feed.remove_activity(foreign_id="Content:" + str(self.id))
         return True
     except:
         return False
コード例 #25
0
 def remove_fields_from_stream(self, **kwargs):
     try:
         client = stream.connect(current_app.config['STREAM_API_KEY'], current_app.config['STREAM_SECRET'])
         client.activity_partial_update(foreign_id='Content:' + str(self.id),
                                        time=self.timestamp,
                                        unset=kwargs
                                        )
         return True
     except:
         return False
コード例 #26
0
    def test_location_support(self):
        client = stream.connect('a', 'b', 'c', location='us-east')

        full_location = 'https://us-east-api.getstream.io/api/'
        if self.local_tests:
            full_location = 'http://localhost:8000/api/'

        self.assertEqual(client.location, 'us-east')
        self.assertEqual(client.base_url, full_location)

        # test a wrong location, can only work on non-local test running
        if not self.local_tests:
            client = stream.connect('a',
                                    'b',
                                    'c',
                                    location='nonexistant')
            def get_feed():
                f = client.feed('user', '1').get()
            self.assertRaises(requests.exceptions.ConnectionError, get_feed)
コード例 #27
0
def test_original_server():
    client = stream.connect('5e62adrfbcxw', 'qxshw6rvbgcv4ghb342fevzp75h53qhga8vajmd6s4pr6f7kcyfx72w5j693xe3t')
    f = client.feed('feed', "user_9_0_5600c2359e08b6b9653ce87e_official")
    res = f.get(offset=0,limit=1)
    print res

    assert 'duration' in res
    assert 'results' in res
    assert 'next' in res
    assert len(res['results']) <= 1
コード例 #28
0
 def test_heroku_location(self):
     url = 'https://*****:*****@us-east.getstream.io/?app_id=1'
     os.environ['STREAM_URL'] = url
     client = stream.connect()
     self.assertEqual(client.api_key, 'ahj2ndz7gsan')
     self.assertEqual(
         client.api_secret, 'gthc2t9gh7pzq52f6cky8w4r4up9dr6rju9w3fjgmkv6cdvvav2ufe5fv7e2r9qy')
     self.assertEqual(
         client.base_url, 'https://us-east-api.getstream.io/api/')
     self.assertEqual(client.app_id, '1')
コード例 #29
0
ファイル: tests.py プロジェクト: Aigeruth/stream-python
 def test_api_key_exception(self):
     self.c = stream.connect(
         '5crf3bhfzesnMISSING',
         'tfq2sdqpj9g446sbv653x3aqmgn33hsn8uzdc9jpskaw8mj6vsnhzswuwptuj9su'
     )
     self.user1 = self.c.feed('user', '1')
     activity_data = {'actor': 1, 'verb': 'tweet',
                      'object': 1, 'debug_example_undefined': 'test'}
     self.assertRaises(ApiKeyException, lambda:
                       self.user1.add_activity(activity_data))
コード例 #30
0
    def test_location_support(self):
        client = stream.connect("a", "b", "c", location="us-east")

        full_location = "https://us-east-api.stream-io-api.com/api/v1.0/feed/"
        if self.local_tests:
            full_location = "http://localhost:8000/api/v1.0/feed/"

        self.assertEqual(client.location, "us-east")
        feed_url = client.get_full_url("api", "feed/")
        self.assertEqual(feed_url, full_location)

        # test a wrong location, can only work on non-local test running
        if not self.local_tests:
            client = stream.connect("a", "b", "c", location="nonexistant")

            def get_feed():
                f = client.feed("user", "1").get()

            self.assertRaises(requests.exceptions.ConnectionError, get_feed)
コード例 #31
0
ファイル: tests.py プロジェクト: Aigeruth/stream-python
 def test_heroku_location(self):
     url = 'https://*****:*****@us-east.getstream.io/?app_id=1'
     os.environ['STREAM_URL'] = url
     client = stream.connect()
     self.assertEqual(client.api_key, 'ahj2ndz7gsan')
     self.assertEqual(
         client.api_secret, 'gthc2t9gh7pzq52f6cky8w4r4up9dr6rju9w3fjgmkv6cdvvav2ufe5fv7e2r9qy')
     self.assertEqual(
         client.base_url, 'https://us-east-api.getstream.io/api/')
     self.assertEqual(client.app_id, '1')
コード例 #32
0
 def test_api_key_exception(self):
     self.c = stream.connect(
         '5crf3bhfzesnMISSING',
         'tfq2sdqpj9g446sbv653x3aqmgn33hsn8uzdc9jpskaw8mj6vsnhzswuwptuj9su'
     )
     self.user1 = self.c.feed('user', '1')
     activity_data = {'actor': 1, 'verb': 'tweet',
                      'object': 1, 'debug_example_undefined': 'test'}
     self.assertRaises(ApiKeyException, lambda:
                       self.user1.add_activity(activity_data))
コード例 #33
0
ファイル: test_client.py プロジェクト: xtaraim/stream-python
    def test_api_url_default(self):
        client = stream.connect(
            'key',
            'secret',
        )
        feed_url = client.get_full_url(service_name='api',
                                       relative_url='feed/')

        if not self.local_tests:
            self.assertEqual(feed_url,
                             'https://api.stream-io-api.com/api/v1.0/feed/')
コード例 #34
0
def get_token(event):
    try:
        client = stream.connect(
            'mwb8vtrjbmak',
            'vqamq876cznxede4fvgpt247w82pwuxs3wwru8sku7nv9w8azp6ae5zn52cp6qz9',
            location='us-east')
        user_feed = client.feed(event['queryStringParameters']['mode'],
                                event['queryStringParameters']['user'])
        return respond(None, user_feed.get_readonly_token(), None)
    except Exception as e:
        return respond(e, None, 502)
コード例 #35
0
    def test_personalization_url_location(self):
        client = stream.connect("key", "secret", location="tokyo")
        feed_url = client.get_full_url(
            relative_url="recommended", service_name="personalization"
        )

        if not self.local_tests:
            self.assertEqual(
                feed_url,
                "https://tokyo-personalization.stream-io-api.com/personalization/v1.0/recommended",
            )
コード例 #36
0
ファイル: test_client.py プロジェクト: xtaraim/stream-python
    def test_collections_url_location(self):
        client = stream.connect(
            'key',
            'secret',
            location='tokyo',
        )
        feed_url = client.get_full_url(relative_url='meta/',
                                       service_name='api')

        if not self.local_tests:
            self.assertEqual(
                feed_url, 'https://tokyo-api.stream-io-api.com/api/v1.0/meta/')
コード例 #37
0
def test_new_server():
    client = stream.connect('5e62adrfbcxw', 'qxshw6rvbgcv4ghb342fevzp75h53qhga8vajmd6s4pr6f7kcyfx72w5j693xe3t')
    # change from original endpoint to the new one to test
    client.base_url = "http://192.168.99.100:5000/api/"
    f = client.feed('feed', "user_9_0_5600c2359e08b6b9653ce87e_official")
    res = f.get(offset=0,limit=1)
    print res

    assert 'duration' in res
    assert 'results' in res
    assert 'next' in res
    assert len(res['results']) <= 1
コード例 #38
0
ファイル: test_client.py プロジェクト: xtaraim/stream-python
    def test_personalization_url_default(self):
        client = stream.connect(
            'key',
            'secret',
        )
        feed_url = client.get_full_url(relative_url='recommended',
                                       service_name='personalization')

        if not self.local_tests:
            self.assertEqual(
                feed_url,
                'https://personalization.stream-io-api.com/personalization/v1.0/recommended'
            )
コード例 #39
0
ファイル: getFeed.py プロジェクト: bhawesh96/nerdtalk
def get_feed(event):
    try:
        client = stream.connect(
            'mwb8vtrjbmak',
            'vqamq876cznxede4fvgpt247w82pwuxs3wwru8sku7nv9w8azp6ae5zn52cp6qz9',
            location='us-east')
        user_feed = client.feed(event['queryStringParameters']['mode'],
                                event['queryStringParameters']['user'])

        feed = user_feed.get(limit=event['queryStringParameters']['limit'],
                             offset=event['queryStringParameters']['offset'])
        return respond(None, feed)
    except Exception as err:
        return respond(err, None, 502)
コード例 #40
0
ファイル: follow.py プロジェクト: bhawesh96/nerdtalk
def follow(event):
    try:
        client = stream.connect(
            'mwb8vtrjbmak',
            'vqamq876cznxede4fvgpt247w82pwuxs3wwru8sku7nv9w8azp6ae5zn52cp6qz9',
            location='us-east')
        user_feed = client.feed(event['queryStringParameters']['mode1'],
                                event['queryStringParameters']['user1'])
        user_feed.follow(event['queryStringParameters']['mode2'],
                         event['queryStringParameters']['user2'])
        return respond(None, "Success")

    except Exception as e:
        return respond(e, None, 502)
コード例 #41
0
    def test_heroku_no_location(self):
        url = 'https://*****:*****@getstream.io/?app_id=669'
        os.environ['STREAM_URL'] = url
        client = stream.connect()
        self.assertEqual(client.api_key, 'bvt88g4kvc63')
        self.assertEqual(
            client.api_secret,
            'twc5ywfste5bm2ngqkzs7ukxk3pn96yweghjrxcmcrarnt3j4dqj3tucbhym5wfd')
        self.assertEqual(client.app_id, '669')

        if self.local_tests:
            self.assertEqual(client.base_url, 'http://localhost:8000/api/')
        else:
            self.assertEqual(client.base_url, 'https://api.getstream.io/api/')
コード例 #42
0
    def test_heroku_no_location(self):
        url = 'https://*****:*****@getstream.io/?app_id=669'
        os.environ['STREAM_URL'] = url
        client = stream.connect()
        self.assertEqual(client.api_key, 'bvt88g4kvc63')
        self.assertEqual(
            client.api_secret, 'twc5ywfste5bm2ngqkzs7ukxk3pn96yweghjrxcmcrarnt3j4dqj3tucbhym5wfd')
        self.assertEqual(client.app_id, '669')

        if self.local_tests:
            self.assertEqual(
                client.base_url, 'http://localhost:8000/api/')
        else:
            self.assertEqual(
                client.base_url, 'https://api.getstream.io/api/')
コード例 #43
0
 def test_api_key_exception(self):
     self.c = stream.connect(
         "5crf3bhfzesnMISSING",
         "tfq2sdqpj9g446sbv653x3aqmgn33hsn8uzdc9jpskaw8mj6vsnhzswuwptuj9su",
     )
     self.user1 = self.c.feed("user", "1")
     activity_data = {
         "actor": 1,
         "verb": "tweet",
         "object": 1,
         "debug_example_undefined": "test",
     }
     self.assertRaises(
         ApiKeyException, lambda: self.user1.add_activity(activity_data)
     )
コード例 #44
0
def connect_debug():
    try:
        key = os.environ['STREAM_KEY']
        secret = os.environ['STREAM_SECRET']
    except KeyError:
        print('To run the tests the STREAM_KEY and STREAM_SECRET variables '
              'need to be available. \n'
              'Please create a pull request if you are an external '
              'contributor, because these variables are automatically added '
              'by Travis.')
        sys.exit(1)

    return stream.connect(
        key,
        secret,
        location='us-east',
        timeout=30,
        base_url='http://qa-api.getstream.io/api/',
    )
コード例 #45
0
ファイル: views.py プロジェクト: sibis/django-calcapp
def home(request):
	a = 'sibi test getStream'
	client = stream.connect('tzn84uddddhm', 'hd722ggruc6s6qjzrdskywtctug63r2h396yjhamrbe72cztqgnmkzzvzmh3dzv9', location='eu-central')
	

	# Create a bit more complex activity
	user_feed_1 = client.feed('user', '1')
	activity_data = {'actor': '1', 'verb': 'run', 'object': 'test',
	    'participants': ['Sibi'],
	    'started_at': datetime.datetime.now(),
	    'foreign_id': 'run:1'
	}
	user_feed_1.add_activity(activity_data)
	notification_feed = client.feed('user', '1')

	return render(request, 'home.html',
                {
                'a':a,
                'token':notification_feed.token,
                })
コード例 #46
0
ファイル: stream_client.py プロジェクト: brecke/twitcare
import stream
import os
from app import app

client = stream.connect(app.config['API_KEY'], app.config['API_SECRET'])
コード例 #47
0
ファイル: views.py プロジェクト: sibis/django-calcapp
def calculator(request):
	value = Calculations.objects.all().order_by('-time')
	client = stream.connect('tzn84uddddhm', 'hd722ggruc6s6qjzrdskywtctug63r2h396yjhamrbe72cztqgnmkzzvzmh3dzv9', location='eu-central')
	notification_feed = client.feed('user', '1')
	return render(request, 'calculator.html',{'value':value,'token':notification_feed.token})
コード例 #48
0
ファイル: client.py プロジェクト: pdonaire1/stream-django
from stream_django import conf
import os
import stream
from django.core.exceptions import ImproperlyConfigured

if conf.API_KEY and conf.API_SECRET:
    stream_client = stream.connect(
        conf.API_KEY, conf.API_SECRET, location=conf.LOCATION, timeout=conf.TIMEOUT)
else:
    stream_client = stream.connect()

if os.environ.get('STREAM_URL') is None and not(conf.API_KEY and conf.API_SECRET):
    raise ImproperlyConfigured('Stream credentials are not set in your settings')
コード例 #49
0
ファイル: tests.py プロジェクト: Aigeruth/stream-python
 def test_wrong_feed_spec(self):
     self.c = stream.connect(
         '5crf3bhfzesnMISSING',
         'tfq2sdqpj9g446sbv653x3aqmgn33hsn8uzdc9jpskaw8mj6vsnhzswuwptuj9su'
     )
     self.assertRaises(TypeError, lambda: getfeed('user1'))
コード例 #50
0
ファイル: clubapis.py プロジェクト: sid-reddevil1803/GSAE
from Models import JoinClubMiniForm
from Models import FollowClubMiniForm
from Models import ClubListResponse
from Models import ProfileMiniForm,Events,Event,ModifyEvent
from Models import ClubRetrievalMiniForm
from Models import RequestMiniForm
from CollegesAPI import getColleges,createCollege
from PostsAPI import postEntry,postRequest,deletePost,unlikePost,likePost,commentForm,copyPostToForm,editpost
from PostsAPI import copyPostRequestToForm,update
from EventsAPI import eventEntry,copyEventToForm,deleteEvent,attendEvent
from ClubAPI import createClub,createClubAfterApproval,getClub,unfollowClub
from ProfileAPI import _copyProfileToForm,_doProfile,_getProfileFromUser
from settings import ANROID_CLIENT_ID,WEB_CLIENT_ID
EMAIL_SCOPE = endpoints.EMAIL_SCOPE
API_EXPLORER_CLIENT_ID = endpoints.API_EXPLORER_CLIENT_ID
client = stream.connect('pp5fhr4zu9zt', '3ndmbn5879tw5bdwur43583z4qc9327r4nkn8r7frtj6s6djf5hxw94e46wuccsx')
@endpoints.api(name='clubs', version='v1',
    allowed_client_ids=[ANROID_CLIENT_ID,WEB_CLIENT_ID,API_EXPLORER_CLIENT_ID],
    scopes=[EMAIL_SCOPE])

# GETSTREAM KEY - urgm3xjebe9d

class ClubApi(remote.Service):

   @endpoints.method(GetClubMiniForm,ClubMiniForm,path='getClub', http_method='POST', name='getClub')
   def getClubApi(self,request):
        print("Request entity is",request)
        retClub = ClubMiniForm()
        if request:
             retClub = getClub(request)
コード例 #51
0
ファイル: helloapi.py プロジェクト: vicvinc/dota2ark
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Administrator
# @Date:   2015-08-10 10:04:04
# @Last Modified by:   Administrator
# @Last Modified time: 2015-08-10 10:04:09

import stream
client = stream.connect('wuu4zhjnj2k2', '8u8npqaamm8qr8pysumfrp9s5umc77yvvqyhkqsukm6drpmhm5xw5pbxbxwr9tbp')
# Get the feed object
eric_feed = client.feed('user', 'eric')
# Add the activity to the feed
eric_feed.add_activity({'actor': 'eric', 'verb': 'tweet', 'object': 1, 'tweet': 'Hello world'});
コード例 #52
0
ファイル: ericFeed.py プロジェクト: csmyth95/PhotoShare
import stream

# SCALABLE NEWS FEED
#Works for 3 users but can be changed for more

#Part 1
client = stream.connect('8d2pm9kfhbt4', 'bpqn7haggg75qdjuwgfagfu4n9wspekn2hq8z88wq2hm7j3btym45p7g3rrmg6gt')
# Get the feed object
eric_feed = client.feed('user', 'eric')
# Add the activity to the feed
eric_feed.add_activity({'actor': 'eric', 'verb': 'tweet', 'object': 1, 'tweet': 'Hello world'});

#Part 2
# Let Jessica's flat feed follow Eric's and Rick's feeds
jessica_flat_feed = client.feed('flat', 'jessica')
jessica_flat_feed.follow('user', 'eric')
jessica_flat_feed.follow('user', 'rick')

# activities on Eric's personal feed will flow automatically in Jessica's feed
user1 = client.feed('user', '1')
user1.add_activity({'actor': 1, 'verb': 'watch', 'object': 1, 'youtube_id': 'z_AbfPXTKms'});

# Read the activities from Jessica's flat feed
response = jessica_flat_feed.get(limit=3)
コード例 #53
0
ファイル: tests.py プロジェクト: allen-smithee/stream-python
def connect_debug():
    return stream.connect(
        u'ahj2ndz7gsan',
        u'gthc2t9gh7pzq52f6cky8w4r4up9dr6rju9w3fjgmkv6cdvvav2ufe5fv7e2r9qy'
    )
コード例 #54
0
ファイル: client.py プロジェクト: AlexGeb/stream-django
from stream_django import conf
import os
import stream
from django.core.exceptions import ImproperlyConfigured

if conf.API_KEY and conf.API_SECRET:
    stream_client = stream.connect(
        conf.API_KEY, conf.API_SECRET, location=conf.LOCATION)
else:
    stream_client = stream.connect()

if os.environ.get('STREAM_URL') is None and not(conf.API_KEY and conf.API_SECRET):
    raise ImproperlyConfigured('Stream credentials are not set in your settings')