I am trying to set up my first ever API connection with Yelp, I am using GAE on Python. To do so, I used the following example: https://github.com/Yelp/yelp-api/blob/master/v2/python/search.py
At first I simply try to run the code by the following definition in my app.yaml
handlers:
- url: /search
script: search.py
However when I load the page it gives the following error: No module named oauth2. I have read through many of the topics that seem to cover this error but none really helped in resolving it. I also tried importing oauth2client which was mentioned in some answers however this was also not accepted.
The only thing that was accepted by the system was
from google.appengine.api import oauth
Therefore I tried to work with this module, but immediately ran into another problem. I filled out my credentials (consumer_key, consumer_secret, token, token_secret) by defining them as default value in the parser definition. To replicate the examples request on https://github.com/Yelp/yelp-api/tree/master/v2/python I also added a default value for 'term' (bars) and 'location' (sf).
When loading the page with this it however gives me the error 'module' object has no attribute 'Consumer', so this also doesn't seem to be the solution. As said this is my first time setting up such a system, so probably I am missing something obvious. Thanks a lot for your thoughts.
You cannot replace modules just like that, the script you are referring to works with the oauth2 library, which is different from GAE OAuth API (that's why you were getting the 'module' object has no attribute 'Consumer').
As explained in the README of the yelp-api, first you need to install the oauth2 module. Note that you need to copy the installed module (or source) to your GAE project in order to upload it to GAE when deploying.
Related
Following the guide in Google's documentation I am attempting to update fields for a device. This returns Permission denied. Did you provide the correct client id? which I have verified is absolutely the correct id.
If I log the error.msg I get HTTP Error 400: Bad Request, and looking at the contents I see that
<p>The requested URL <code>/v1/devices/abc123/deviceUsers/abc-123-ddd/clientState/companyid-string?updateMask=healthScore</code> was not found on this server. <ins>That\xe2\x80\x99s all we know.
I took the resource name from using the list method, as suggested by the docs, so I am fairly certain this is the correct name. I don't believe its a scope permission error as the scope listed works to list/get devices.
I have tried updating different fields, different devices, and switching it up as much as I could think to do and still run into a 400. If anyone has updated any of the clientState fields and can provide guidance I would greatly appreciate it.
I'm trying to use Google API and the build instance has no attributes. Not even the sample project from Google works: https://developers.google.com/calendar/quickstart/python
I have tried to reinstall the libraries and forcing reinstall using:
"pip install --force-reinstall google-api-python-client".
Code from another Google site which does not work either:
from googleapiclient.discovery import build
API_KEY='my_apiKey'
GPLUS = build('plus', 'v1', developerKey=API_KEY)
TMPL = '''
User: %s
Date: %s
Post: %s
'''
items = GPLUS.event() # AttributeError: 'Resource' object has no attribute 'event'
The service you're building with the code you provided is the Google+ API Client. According to the docs for this client there's no attribute or function called event(), and so you get the corresponding error message when running your code. Take a look at those docs to see what you should be able to do with this client. There appears to be a quick sample on Github.
After some more testing i can verify that there exist attributes since the code is working but pylint in VS Code does not find the attributes and therefore mark them as non existing.
I have not idea though why this is happening.
I am new in Splunk - as well as in Python and start working on Splunk Custom Module and I have taken reference from Splunk Site Custom Module. When I have created Same file structure using Visual Studio 2017 -> Python3 then its give me an error
import controllers.module not found
import splunk not found
import splunk.search not found
import splunk.util not found
import splunk.entity not found
import json from splunk.appserver.mrsparkle.lib not found
import lib.util as util not found
Note: I have already imported Splunk SDK using "pip install splunk-sdk" Still, I can't find any package in the project.
Please, anyone, guide me how to resolve above custom module package error.
If there is any readymade samples are available then please suggest a link.
Thanks in advance
You may be wasting your time. Splunk Modules have been deprecated for over a year and may become unsupported at any time.
The packages you are looking for should be part of Splunk. Have you installed it?
I believe Splunk does not support Python 3. Try 2.7.
Have you tried taking a look to simple_xml_exaples app for sourcecodeviewer implementation. I think it is a good approach for adding custom HTML + CCS + third party.js.
Furthermore it can be implemented in a custom dashboard.js
edit
Download Simple xml examples APP; in every example dashboard it can be seen that it has a custom component called sourceviewer, that is injected after the load time in every dashboard page.
For that a custom
dashboard.js
is created and inserted in APP/appserver/static so this will override the original
so then you can insert in every dashboard page the new needed components without even afecting the dashboard xml part and its functionalities as pdf generator.
I used that way in order to implement custom Nav as a SideBar.
I'm trying to use the etsy API and I was finally able to get it running from the source. I gave it my key, and it returned the following when printed out.
<etsy._v2.EtsyV2 object at 0xb7284ccc>
However I have no idea what to do with it. The github-repo doesn't have much documentation, and the command that is suppose to follow doesn't work. I read the Etsy API and didn't find the mentioned command getFrontFeaturedListings like the github listed.
I've had this issue before with an HTTP response object and I was told to use response.content to check out more info on the object. It didn't work for this object so I'm wondering if there was a simple way to test any generic object, or at least see what this object contains?
When in doubt you can always use the dir built-in method on an arbitrary python object. This will show you methods and fields attached to the object. https://docs.python.org/3/library/functions.html#dir
Anyway, sorry to hear about the poor documentation of the library. Last time I used Etsy's API I just created a little class that used requests. It wasn't much work since Etsy lays out all of the URIs + documentation nicely on their developer site. https://www.etsy.com/developers/documentation/reference/favoritelisting
I'm sorry but I'm having some trouble implementing Oauth within my app engine python project.
I've been working from http://github.com/tav/tweetapp, but I don't think I have a strong enough grasp on this platform to understand how to implement this class within my main.py I'm building the rest of my app in.
This maybe a feeble attempt, but here is what I have so far:
twa = twitter_auth
client = twa.OAuthClient('twitter')
I've created a source folder within my project called "twitter_auth" and that contains a file within it called "twitter_auth.py" which contains the above linked library, and a file called __ init__.py (no space) which is completely empty.
I really have no idea what to do from here :/
Let me recommend taking a look at the tweepy library and some example tweepy apps. Specifically here: http://github.com/wasauce/tweepy-examples
This shows how to use oauth to authenticate a user: http://github.com/wasauce/tweepy-examples/tree/master/appengine/oauth_example/
As Hagge said, it sounds like your issue is more with the tweetapp library than with App Engine. However, if you would like to know more about OAuth on App Engine and if I may be allowed to link to myself, my two articles on the topic seem to be reasonably popular.
The tweetapp library was a an early prototype for Twitter OAuth on twitter. Tav did the heavy lifting and I deployed the site http://twitteroauth.appspot.com , using some of the tweetapp library. The actual source of that site is here (I need to update the site to point here): http://github.com/ryanwi/twitteroauth
I am still using it in production, but, it has aged and does not work for all API calls. I'd recommend trying a different, more up to date and maintained library as others have mentioned.
But, take a look at the twitteroauth source if you want to try to get a first attempt working.
These two are on Twitter's list
http://github.com/brosner/python-oauth2
http://code.google.com/p/oauth-python-twitter2/
I'm not familiar with that library, but after a quick look and seeing the warning that it is not maintained I'd search for something better. I implemented a simple Twitter connection based on Tornado's auth: see an example of how to make Twitter API calls here (and an authentication example here). In case you don't want to use tipfy, I recommend implementing the python-twitter library in your framework of choice.