I have "created" a Twitter parser in Python 2.7, which pretty much can parse everything available from the API. As everyone else the REST API limit is killing me. I am trying to create a social graph (pretty big I'd say) and time is of the essence. So I thought, what if I could use a proxy? And the fact is I managed to with urllib, but any try to recreate the parser with urllib this would destroy all the hours put into python-twitter. So my Extended(question) is, can someone please explain how to patch the twitter.py with these instructions: http://code.google.com/p/python-twitter/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Type%20Status%20Priority%20Milestone%20Owner%20Summary&groupby=&sort=&id=205
Or even better, anyone knows any similar workarounds the REST API limit? Moreover, are any other python modules offering oAuth and proxy support?
I'm not sure whether python-twitter supports proxy. But, there is a project which implements proxy support for python-twitter. Have a look at https://github.com/dhananjaysathe/python-twitter-with-proxy
Related
I am quite new to python, I have built some applications in python with CGI and I found cgi is much easier compare to a framework as i have full control on everything.
Tried to build a web api through below module but it end up with a web page rather than an api.
Import cgi
Import cgitb
I would like to create a web api, as I am familiar with cgi i would like to create it (web api) through python cgi,I have been looking for a good documentation but i dint find any. It would be helpful if someone can give me a clue. I really appreciate your help.
CGI applications are nothing but backend of HTTP kind protocol, so I guess you could naturally build REST API on top of it: http://en.wikipedia.org/wiki/Representational_state_transfer
Also python have good build-in support for HTTP for better understanding from inside (in case u like to keep control on everything): https://docs.python.org/3/library/http.server.html#module-http.server
Anyway, when your getting better in it your best bet to switch on a framework like these: https://www.djangoproject.com/ http://www.tornadoweb.org/en/stable/
Momentarily I am creating a python based application through the programme Ren'py. Now I have to couple the game with a SQL database. The admin on the board of the programme recommended using urllib to do this.
http://lemmasoft.renai.us/forums/viewtopic.php?f=8&t=29954
This is my thread. Now, I've managed to succesfully add the urllib to the program, but I'm lost at the entire "talk to a web service, which would then talk to the sqlite database" segment. Could you perhaps provide any hints/ tips?
I've never worked with Python before, so it's kind of challenging.
The answer you got on that forum isn't very helpful, in that the poster didn't really explain what they meant.
urllib is really the most minor component of the solution they're suggesting. What they actually mean is that you set up an entire web service, hosted on a URL somewhere, which talks to its own database. Your local installations of the app would then use a Python web library to communicate with that remote database over the web.
While this isn't particularly difficult, it is a fair amount of work, especially if you don't have any experience in doing this. You'll need a Python web framework and somewhere to host it. Since you talk about admins needing to log in and view data, you might want to explore Django, which comes with a built-in admin interface.
You'll then need to design an API to allow your Ren'py app to communicate with that web service, and you might want to look at the Django REST framework for that. The final part is getting your app to talk to the web service, which is where the recommendation of urllib comes in - but to be honest, that isn't even a very good recommendation here: the third-party library requests would be much better.
As I say, there's quite a lot of work. A much simpler solution would be to use Python's built-in sqlite3 library to talk to a local database via SQL, but that wouldn't do anything to make people's data available in a central location and would be open to anyone who worked out how to query the database.
I'm looking for a Payment gateway that offers Python SDK which would run on GAE. So far I've looked at Braintree[1] and TrustCommerce[2], and both required C-based libraries to work, which won't work on GAE. If there's no such thing, which payment gateway would you recommend that provides a possibly JSON-based API or a nice RESTful API.
[1] http://www.braintreepayments.com/
[2] http://www.trustcommerce.com/
Braintree uses PycURL library which is C-based
TrustCommerce comes with some C files that need to be compiled during install
EDIT:
I'll vote close on this, because it's been suggested that such thing is impossible because URLfetch has a 10 second limit which is not sufficient in this case. For those interested, it has been suggested to me that using a proxy for payment processing would be better.
It would be really helpful if you provided links. I googled and found this TrustCommerce, but I guess maybe it's a different company to the one you are talking about because they say there is sample Python code.
I didn't sign up for a trial account just to see if the Python API requires a C library. Afterall maybe it's not even the same TrustCommerce you have looked at.
This isn't really the right site to do your research, you should come back and ask for help if you have problems using the API when you have found/chosen one.
I have a requirement to build a client for Shopify's API, building it in Python & Django.
I've never done it before and so I'm wondering if someone might advise on a good starting point for the kinds of patterns and techniques needed to get a job like this done.
Here's a link to the Shopify API reference
Thanks.
Your question is somewhat open-ended, but if you're new to Python or API programming, then you should get a feel for how to do network programming in Python, using either the urllib2 or httplib modules that come with more recent versions of Python. Learn how to initiate a request for a page and read the response into a file.
Here is an overview of the httplib module in Python documentation:
http://docs.python.org/library/httplib.html
After you've managed to make page requests using the GET HTTP verb, learn about how to make POST requests and how to add headers, like Content-Type, to your request. When communicating with most APIs, you need to be able to send these.
The next step would be to get familiar with the XML standard and how XML documents are constructed. Then, play around with different XML libraries in Python. There are several, but I've always used xml.dom.minidom module. In order to talk to an API, you'll probably need to know to create XML documents (to include in your requests) and how to parse content out of them. (to make use of the API's responses) The minidom module allows a developer to do both of these. For your reference:
http://docs.python.org/library/xml.dom.minidom.html
Your final solution will likely put both of these together, where you create an XML document, submit it as content to the appropriate Shopify REST API URL, and then have your application deal with the XML response the API sends back to you.
If you're sending any sensitive data, be sure to use HTTPS over port 443, and NOT HTTP over port 80.
I have been working on a project for the last few months using Python and Django integrating with Shopify, built on Google App Engine.
Shopify has a valuable wiki resource, http://wiki.shopify.com/Using_the_shopify_python_api. This is what I used to get a good handle of the Shopify Python API that was mentioned, https://github.com/Shopify/shopify_python_api.
It will really depend on what you are building, but these are good resources to get you started. Also, understanding the Shopify API will help when using the Python API for Shopify.
Shopify has now released a Python API client: https://github.com/Shopify/shopify_python_api
I think you can find some inspiration by taking a look at this:
http://bitbucket.org/jespern/django-piston/wiki/Home
Although it is directly opposite what you want to do (Piston is for building APIs, and what you want is to use an API) it can give you some clues on common topics.
I could mention, of course, reading obvious sources like the Shopify developers forum:
http://forums.shopify.com/categories/9
But I guess you already had it in mind :)
Cheers,
H.
I am writing a REST service in python and django and wanted to use Amazon's AWS authentication protocol. I was wondering if anyone knew of a python library that implemented formation of the header for sending and the validation of the header for recieving?
Try this Library. I think it is the library you are searching for..
CalNet
You can find some Python Code Samples Here
boto is a Python library for AWS. I don't know however if it supports what you are asking for.
I think this code does exactly what you want :)
I'll be happy to get comments for improvement if needed.