Error 16112 - How to connect to Ebay without interactivity? - python

So, I'm trying to use the ebaysdk-python module, to connect to ebay and get a list of orders. After struggle a little bit with the connection, I've finally have found the ebay.yaml syntax. I have then configured the user and password, but I'm receiving this Error 16112.
So, this is my question: is there a way to connect to ebay without interactivity? I mean, without the need to give the permission to get the token and such (oauth)?

I've finally found the way to do this: I have created a user token using the method auth'n'auth. This user token have almost a year of validity, so it can be used for my purpose. Now, there is another question around that.

Related

Firebase rules - permission denied in orderBy query even though 'get' request works (REST)

I'm using Python and the REST API for querying firebase. I want to query my database by a field called 'my_friend_id'. Here are my rules:
I'm able to get the friend id of any user without being authenticated using a get request to /$uid/my_friend_id but when I try to order by $uids by my_friend_id I get a permission denied. I want to figure out someones lengthy uid using a short my_friend_id.
It seems like my permission is denied because my orderBy="my_friend_id" query is rejected by the top level rules at /, but I want it to be allowed based off of my rules in /$uid/my_friend_id. What am I doing wrong?
The solution was to incorporate a new rule at the root (/) level of the database that relates to queries. See the highlighted line in the image of my new rules. More info in the link of Frank van Puffelen's comment on my question.
Make sure to include authorization features if your data should be secure!

Show Server details via Python OpenStack API using the nova client

I am trying to convert my BASH script to Python and am having difficulties in finding the equivalent code for openstack server show or openstack server list --long. I would like to know what host is my server currently located and use this information for a check before migrating it to another host.
Looking through the latest novaclient documentation and its servers module, I have found two potential commands that I was hoping would accomplish the task, but does not do so:
list(detailed=True)
Gets a list servers
detailed=True should return detailed server info (optional).
This returns a regular list of servers with their names.
get(server)
Get a server
This returns only the name of the server.
I have been researching for the past two days, and I could not find the same / similar problem here in stack overflow so I have decided to ask and I am hoping that someone can help me with this.
Either list or get should be fine here.
As an example get would be used like this.
instance = nova_client.servers.get('my-server')
print(instance.name)
print(instance.addresses)
print(instance.status)
Or using list.
for instance in nova_client.servers.list():
print(instance.name)
print(instance.addresses)
print(instance.status)
If you want an easy way of understanding the type of data you can get, you can simply use the Python inbuilt dir.
instance = nova_client.servers.get('my-server')
print(dir(instance))
'my-server' needs to be the id as in instance.id, the name of the server is not valid.
I cant yet comment, so i wrote an answer.

I can't send Emails using Django non-rel on GAE

Im trying to send a simple email to do the password recover of a user, the input is just a email to send the new password..
But i can't... i get this error
SMTPServerDisconnected: please run connect() first
I already tried a few examples, like, https://bitbucket.org/andialbrecht/appengine_emailbackends/overview, but i get the same error
I really need this, maybe someone can tell me how to use an alternative to code in my view to send an email...Also i changed the backend to
EMAIL_BACKEND = 'djangoappengine.mail.EmailBackend'
but nothing,i don't know how to use this backend anyway :(
Plz Help :(
maybe someone can tell me how to use an alternative to code in my view to send an email...
I can help with this, seeing as it seems that perhaps this repository you're trying to use is based on an earlier version of App Engine and is throwing the error due to a required code change somewhere in the library - either that or the fact that you changed the string from what the library recommends (your version: 'djangoappengine.mail.EmailBackend') to a string that seems to not be correct, as it's different to what the author of the repository directed you to use (their version: 'appengine_emailbackend.EmailBackend'), and this is causing trouble.
Whenever possible, I'd recommend seeing if there is an "app-engine-y" way to do something, before going to a third-party library or deploying a module somebody else wrote to hack in third-party capabilities, or looking for an advanced/experimental feature (for example, use Datastore first, rather than remotely connecting to a MySQL VM, unless you need MySQL). If you absolutely need that library, this is a different story, but if you just want to send emails, the Mail API is what you need. It's a convenient way to send emails on App Engine.
I'm going to assume in the following that you are storing your user's usernames and hashed passwords in custom-defined User-kind entities in your Datastore. If you have your users using simple OAuth to sign into your site, there is never any reason to "reset/recover password":
Create the <form action="/some/route" action="POST"> element on
the page where the user requests password recovery.
Put the code responsible for handling this form submission (they will input their email, or whatever account info they need for your code to find their User entity in the Datastore in a handler that will respond on that route.
In the handler, generate a unique token and store it in the Datastore. Send the token in the email that you generate and send using the Mail API (see the example code in the link to the docs I provided). This will allow your user to return to your site, authenticate with the token from the email, and then fill out a form to create a new password. You will then hash this password (with a salt) and store it in their User entity in your Datastore.
I'm skipping over the details of how to implement a "password recovery form", given what I said about OAuth and that you are probably really only concerned with how to send mail. In the email you send, for example, you can insert a hyperlink to your site with the token already inserted as a query param, so that the user doesn't have to copy and paste, etc.

Get multiple connections at once with Python facebook package

To get connections using the Python facebook package I know to use:
g.get_connections("me", "friends")
But is there a way to get "friends" and "books" in one call?
Didn't see anything in the docs...
Based on the Graph API documentation, you can do a request in the form
GET graph.facebook.com
/{node-id}?
fields={first-level}
Thus, you'd want to execute a GET for /me?fields=friends,books, looking at the facebook-sdk code, the g.get_object seems to be the closest one, thus:
g.get_object('/me', fields='friends,books')
Of course chances are that not all are returned, and you need to page through the results anyway...

Trouble getting code parameter on facebook oauth callback

I'm writing a Django app requesting permission to post on facebook.
I can access authorization and callback, but I can't get the parameter 'code' that facebook needs to continue with oauth.
def connect_fb(request):
return redirect("https://graph.facebook.com/oauth/authorize?"
+"client_id=MY_ID&"
+"redirect_uri=MY_URL"
+"&type=user_agent&display=popup&scope=publish_stream")
def callback_facebook(request):
code=request.REQUEST.get("code")
What's the right way to get 'code' so I can continue the oauth process?
I tried several things but I keep getting None instead of a code.
Thanks
I've used django-facebook-oauth in the past, but if you really want to roll your own solution then I'd suggest just looking through their source.
From just glancing through it, the only thing I can see you doing differently is the
&type=user_agent&display=popup
in the URL. The app I linked you to doesn't appear to do that as far as I can tell.
The problem comes from type=user_agent that is used in javascript authentication, and not here.
Removing it allows to get code as above.

Categories