Python JIRA SOAPpy annoying redirect on findIssue - python

I am trying to do WSDL SOAP connection to our JIRA server using SOAPpy (Python SOAP Library).
All seems to be fine except when I try finding specific issues. Through the web browser looking up the bug ID actually redirects to a bug (with a different ID), however it is the bug in question just moved to a different project.
Attempts to getIssue via the SOAPpy API results in an exception that the issue does not exist.
Any way around this?
Thanks

Yes, there's an existing bug on this I've seen. Use the JIRA issue id instead of the key to locate it, as a workaround.

Related

How to login successfully in Instaloader in python?

I am trying to scrape data from Instagram using the 'instaloader' python modules. When using this code:
import instaloader
L = instaloader.Instaloader()
L.login(USERNAME, PASSWORD)
The code throws the following error:
ConnectionException: Login error: Unexpected response, this might indicate a blocked IP.
I've tried looking through the documentation and GitHub issues, but can't seem to find a solution. Please advise how to login successfully, or any other modules that I can use to scrape data?
This can be resolved by logging in to your browser and then running the script.
I'm not sure of the cause, but that's how I fixed it.
Please note some of Instaloaders functionalities are currently not working, presumably due to an update on Instagram.
It might be looks like your ip is blocked by Instagram server.

SSL Error: Bad handshake (Python requests)

I know similar questions have been asked before but I have read all of them and I still cannot figure out a solution for my problem.
I am basically working behind a corporate proxy, so when I do for a example a get request to Google with something like this:
import requests
requests.get('https://www.google.es')
I immediately get an error which points towards a fail in certificate verification. After much reading I have found this post where you can get a sweet explanation of what is going on.
Some solutions I have tried are:
1.https://stackoverflow.com/a/42540637/8380638
2.https://stackoverflow.com/a/48636689/8380638
But still I could not make this work.
My main goal is using Google Translate API from google.cloud python module which uses requests on it. So it would be good to find some fix that goes further from adding a parameter into request.get() function.
You can get the Google Translate API without using the requests library. Simply install the google-cloud-translate library and setup the required authentication on your Google Cloud Platform account as described in the documentation. Once completed, you can directly import the Translate API using the following line:
from google.cloud import translate
I finally found the solution for this, but I forgot to post it.
You can use this to find the path where request library CAs are stored and add your own one at the end of the file.
import requests as r
print(r.certs.where())

What's the difference between "browser posting" and "program posting"?

I've asked one question about this a month ago, it's here: "post" method to communicate directly with a server.
And I still didn't get the reason why sometimes I get 404 error and sometimes everything works fine, I mean I've tried those codes with several different wordpress blogs. Using firefox or IE, you can post the comment without any problem whatever wordpress blog it is, but using python and "post" method directly communicating with a server I got 404 with several blogs. And I've tried to spoof the headers, adding cookies in the code, but the result remains the same. It's bugging me for quite a while... Anybody knows the reason? Or what code should I add to make the program works just like a browser such as firefox or IE etc ? Hopefully you guys would help me out!
You should use somthing like mechanize.
The blog may have some spam protection against this kind of posting. ( Using programmatic post without accessing/reading the page can be easily detected using javascript protection ).
But if it's the case, I'm surprised you receive a 404...
Anyway, if you wanna simulate a real browser, the best way is to use a real browser remote controlled by python.
Check out WebDriver (http://seleniumhq.org/docs/09_webdriver.html) It has a python implementation and can run HtmlUnit, chrome, IE and Firefox browsers.

Facebook calling Google App Engine code using GET instead of POST

I've been developing a Facebook app using Google App Engine in Python and the pyfacebook bindings. For weeks everything worked fine but suddenly it stopped.
At first I thought it was a code change so I rolled back the entire dev directory to a version I knew worked, but still it failed. It's possible a change I made to the application's settings caused the issue but, if so, I can't figure out what.
I've figured out that the problem is that instead of calling the post(self) method of my Main class, Facebook is calling using a GET.
Does anyone know why Facebook would use a GET method instead of a POST? It's an IFrame app.
Thanks,
The typical flow for a user when using the application begins with the user landing at some Canvas URL, like http://apps.facebook.com/runwithfriends/. At this point, Facebook will load up it's chrome, and render a tag to your application. You'll notice there isn't a src specified. Using some JavaScript and the tag, Facebook triggers a POST request to your application. This is done for security reasons, as the sensitive user data won't be sent via the HTTP Referrer header as long it's sent as POST data.
Although I'm not completely sure this was the cause, it appears I changed from an FBML app to an IFrame app. FBML mode relies on POST calls but IFrame appears to use GET. I'm inferring this answer from what I read here as well as from the observations I'm seeing and this being the only answer that makes any sense.

In Python, how might one log in, answer a web form via HTTP POST (not url-encoded), and fetch a returned XML file?

I am basically trying to export a configuration file, once a week. While the product in question allows you to log in manually via a web client, enter some information, and get an XML file back when you submit, there's no facility for automating this. I can get away with using Python 2.5 (have used for a while) or 2.6 (unfamiliar) to do this.
I think I need to have some way to authenticate against the product. Although I can view the cookie in Firefox, when I looked through the actual cookie.txt file, it was not present. Didn't show up after clearing my private data and re-authenticating. Odd. Should I be shooting for the Cookie module, or could this be some arcane method of authentication that only looks like cookies? How would I know?
I think I need the httplib module to do the HTTP POST, but I don't know how to do the multipart/form-data encoding. Have I overlooked a handy option, or is this something where I must roll my own?
I assume I can get the XML file back in the HTTPesponse from httplib.
I've fetched web things via Python before, but not with POST, multipart encoding, and authentication in the mix.
urllib2 should cover all of this.
Here's a Basic Authentication example.
Here's a Post with multipart/form-data.
Try mechanize module.
You should look at the MultipartPostHandler:
http://odin.himinbi.org/MultipartPostHandler.py
And if you need to support unicode file names , see a fix at:
http://peerit.blogspot.com/2007/07/multipartposthandler-doesnt-work-for.html

Categories