예제 #1
0
    def _fetch_resource(self, url, params=None, method=None, body=None):
        if not body and not method or method == 'GET':
            return Yammer._fetch_resource(self, url, params)

        if not self._access_token: raise YammerError('missing access token')
        try:
            o = OAuthRequest.from_consumer_and_token(self._consumer,
                                                     token=self._access_token,
                                                     http_method=method,
                                                     http_url=url,
                                                     parameters=params)
            headers = o.to_header()
            o.sign_request(self._signature, self._consumer, self._access_token)
            url = o.to_url()
        except OAuthError, m:
            raise YammerError(m.message)
예제 #2
0
 def _fetch_resource(self, url, params=None, method=None, body=None):
   if not body and not method or method == 'GET':
     return Yammer._fetch_resource(self, url, params)
   
   if not self._access_token: raise YammerError('missing access token')
   try:
     o = OAuthRequest.from_consumer_and_token(
         self._consumer, token=self._access_token, http_method=method,
         http_url=url, parameters=params)
     headers = o.to_header()
     o.sign_request(self._signature, self._consumer, self._access_token)
     url = o.to_url()
   except OAuthError, m: raise YammerError(m.message)
   try:
     self._connection.request(o.http_method, url, body=body, headers=headers)
   except socket.gaierror, (n, m):
     raise YammerError(m)
예제 #3
0
#

yammer = None
proxy = get_proxy_info()
consumer = get_consumer_info()

# If we already have an access token, we don't need to do the full
# OAuth dance
if ('access_token_key' not in globals()
            or not access_token_key
            or 'access_token_secret' not in globals()
            or not access_token_secret):
    try:
        yammer = Yammer(consumer['key'],
                        consumer['secret'],
                        proxy_host=proxy['host'],
                        proxy_port=proxy['port'],
                        proxy_username=proxy['username'],
                        proxy_password=proxy['password'])
    except YammerError, m:
        print "*** Error: %s" % m.message
        quit()

    print "\n#2 ... Fetching request token.\n"

    try:
        unauth_request_token = yammer.fetch_request_token()
    except YammerError, m:
        print "*** Error: %s" % m.message
        quit()

    unauth_request_token_key = unauth_request_token.key
예제 #4
0
#
# Main
#

yammer = None
proxy = get_proxy_info()
consumer = get_consumer_info()

# If we already have an access token, we don't need to do the full
# OAuth dance
if ('access_token_key' not in globals() or not access_token_key
        or 'access_token_secret' not in globals() or not access_token_secret):
    try:
        yammer = Yammer(consumer['key'],
                        consumer['secret'],
                        proxy_host=proxy['host'],
                        proxy_port=proxy['port'],
                        proxy_username=proxy['username'],
                        proxy_password=proxy['password'])
    except YammerError, m:
        print "*** Error: %s" % m.message
        quit()

    print "\n#2 ... Fetching request token.\n"

    try:
        unauth_request_token = yammer.fetch_request_token()
    except YammerError, m:
        print "*** Error: %s" % m.message
        quit()

    unauth_request_token_key = unauth_request_token.key
예제 #5
0
#
# Main
#

yammer = None
proxy = get_proxy_info()
consumer = get_consumer_info()

# If we already have an access token, we don't need to do the full
# OAuth dance
if not access_token_key or not access_token_secret:
    try:
        yammer = Yammer(consumer['key'],
                        consumer['secret'],
                        proxy_host=proxy['host'],
                        proxy_port=proxy['port'],
                        proxy_username=proxy['username'],
                        proxy_password=proxy['password'])
    except YammerError, m:
        print "*** Error: %s" % m.message
        quit()

    print "\n#2 ... Fetching request token.\n"

    try:
        unauth_request_token = yammer.fetch_request_token()
    except YammerError, m:
        print "*** Error: %s" % m.message
        quit()

    unauth_request_token_key = unauth_request_token.key