New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Script that uploads a file to Google Drive works, but when I try to run that script within another I get an HTTPerror #983
Comments
Hi @filifunk, The error you are getting is 400 bad request - which means that something about the content of the request is invalid. If you're calling out to the same function with the same arguments I would expect a discrepancy in the response. When you run |
@busunkim96 exactly! It works fine when I run |
Hmm, maybe the filepaths? Are the file to upload and the two scripts in the same directory? |
Yep, same directory |
I suggest you try enabling httplib2 logging and comparing the logs from the two runs. This will print out the content of the HTTP requests and responses so it should be easier to figure out what's happening. import httplib2
httplib2.debuglevel = 4 |
great! thanks @busunkim96 , I will get into it a little bit later and report back |
hmmm...so this is the output:
The thing that jumps out to me is the "must revalidate." Is there anything else I should plug into morning3.py? All I have in there for the purpose of uploading the file is:
and
and I tried it again today and morning3.py gives me the error, but running auth.py uploads |
You might want to try renaming As a side note, make sure to redact sensitive information from logs before you post it to the issue tracker. I've removed the text after "Bearer" because that is an authorization token. |
Unfortunately, I changed the name to sendit.py and still get the same issue. Thanks for redacting! I had no idea! |
Hi @filifunk , I'm sorry that it took a while to provide a response. I created a file
|
I'm somewhat of a beginner.
I have a script (morning3.py) that I run that writes and saves a text file and at the end of the script it's supposed to upload that file into google through the api by calling upon another python script called auth.py.
the morning.py file writes the new file but when it tries to upload the file I get this error:
The weird thing is that I don't try to upload the file by importing auth.py and using the function that uploads the file...and run auth.py separately...it works fine!
This is auth.py, looking at this now I know there is probably ugly code here...but here it is:
in morning3.py, I import auth up top and then at the bottom I have this:
auth.uploadfile('test{}.txt'.format(datetime.date.today()), 'test{}.txt'.format(datetime.date.today()), 'txt/csv')
The text was updated successfully, but these errors were encountered: