本文整理汇总了Python中stream.connect函数的典型用法代码示例。如果您正苦于以下问题:Python connect函数的具体用法?Python connect怎么用?Python connect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了connect函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_location_support
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)
开发者ID:Aigeruth,项目名称:stream-python,代码行数:10,代码来源:tests.py
示例2: test_heroku_real
def test_heroku_real(self):
url = 'https://bvt88g4kvc63:t[email protected]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')
开发者ID:allen-smithee,项目名称:stream-python,代码行数:7,代码来源:tests.py
示例3: connect_debug
def connect_debug():
return stream.connect(
'gav9ygr75by3',
'5ws2hnua79n9qga6e2dy572qdfapwgdc83853mjm3mjp66czyb2xkahbdhs98an8',
location='us-east',
timeout=10
)
开发者ID:kennym,项目名称:stream-python,代码行数:7,代码来源:tests.py
示例4: value_storage
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))
开发者ID:sibis,项目名称:django-calcapp,代码行数:27,代码来源:views.py
示例5: test_heroku
def test_heroku(self):
url = 'https://thierry:[email protected]/?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')
开发者ID:Aigeruth,项目名称:stream-python,代码行数:7,代码来源:tests.py
示例6: test_heroku_overwrite
def test_heroku_overwrite(self):
url = 'https://thierry:[email protected]/?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')
开发者ID:Aigeruth,项目名称:stream-python,代码行数:7,代码来源:tests.py
示例7: test_original_server
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
开发者ID:Vixlet,项目名称:Stream-Framework,代码行数:10,代码来源:test_with_client.py
示例8: test_heroku_location
def test_heroku_location(self):
url = 'https://ahj2ndz7gsan:g[email protected]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')
开发者ID:Aigeruth,项目名称:stream-python,代码行数:10,代码来源:tests.py
示例9: test_api_key_exception
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))
开发者ID:Aigeruth,项目名称:stream-python,代码行数:10,代码来源:tests.py
示例10: test_new_server
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
开发者ID:Vixlet,项目名称:Stream-Framework,代码行数:12,代码来源:test_with_client.py
示例11: home
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,
})
开发者ID:sibis,项目名称:django-calcapp,代码行数:20,代码来源:views.py
示例12: test_wrong_feed_spec
def test_wrong_feed_spec(self):
self.c = stream.connect(
'5crf3bhfzesnMISSING',
'tfq2sdqpj9g446sbv653x3aqmgn33hsn8uzdc9jpskaw8mj6vsnhzswuwptuj9su'
)
self.assertRaises(TypeError, lambda: getfeed('user1'))
开发者ID:Aigeruth,项目名称:stream-python,代码行数:6,代码来源:tests.py
示例13: ImproperlyConfigured
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')
开发者ID:pdonaire1,项目名称:stream-django,代码行数:13,代码来源:client.py
示例14:
import stream
import os
from app import app
client = stream.connect(app.config['API_KEY'], app.config['API_SECRET'])
开发者ID:brecke,项目名称:twitcare,代码行数:5,代码来源:stream_client.py
示例15: ImproperlyConfigured
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')
开发者ID:AlexGeb,项目名称:stream-django,代码行数:13,代码来源:client.py
示例16:
#!/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'});
开发者ID:vicvinc,项目名称:dota2ark,代码行数:13,代码来源:helloapi.py
示例17:
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)
开发者ID:csmyth95,项目名称:PhotoShare,代码行数:24,代码来源:ericFeed.py
示例18: connect_debug
def connect_debug():
return stream.connect(
u'ahj2ndz7gsan',
u'gthc2t9gh7pzq52f6cky8w4r4up9dr6rju9w3fjgmkv6cdvvav2ufe5fv7e2r9qy'
)
开发者ID:allen-smithee,项目名称:stream-python,代码行数:5,代码来源:tests.py
示例19: ClubApi
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)
开发者ID:sid-reddevil1803,项目名称:GSAE,代码行数:30,代码来源:clubapis.py
示例20: calculator
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})
开发者ID:sibis,项目名称:django-calcapp,代码行数:5,代码来源:views.py
注:本文中的stream.connect函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论