PhilosChen / appdailysales

Automatically exported from code.google.com/p/appdailysales
0 stars 0 forks source link

2.6 run issues #29

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Running the program (the bug is random, associated with non-correctly 
open/closed connections perhaps)
2.
3.

What is the expected output? What do you see instead?

Expected output is to simply download the report.

Instead it says (on verbose):

-- begin script --
Signing into iTunes Connect web site.
Accessing Sales and Trends reporting web site.
Unable to find default vendor page.
Traceback (most recent call last):
  File "./appdailysales.py", line 476, in <module>
    sys.exit(main())
  File "./appdailysales.py", line 469, in main
    downloadFile(options)
  File "./appdailysales.py", line 272, in downloadFile
    viewState = match[0]
IndexError: list index out of range

What version of the product are you using? On what operating system?
2.6, Mac OSX 10.6

Please provide any additional information below.

I'm also getting an additional error:

Traceback (most recent call last):
  File "/Users/johannes/Documents/Dev/Sales/appdailysales.py", line 476, in <module>
    sys.exit(main())
  File "/Users/johannes/Documents/Dev/Sales/appdailysales.py", line 469, in main
    downloadFile(options)
  File "/Users/johannes/Documents/Dev/Sales/appdailysales.py", line 417, in downloadFile
    filebuffer = gzipIO.read()
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/gzip.py", line 212, in read
    self._read(readsize)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/gzip.py", line 255, in _read
    self._read_gzip_header()
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/gzip.py", line 156, in _read_gzip_header
    raise IOError, 'Not a gzipped file'
IOError: Not a gzipped file

When using a custom format for file download and the date being accessed does 
not have a report available for it.

Original issue reported on code.google.com by jonathan...@gmail.com on 2 Nov 2010 at 8:35

GoogleCodeExporter commented 8 years ago
Here is my script settings:
outputDirectory = ''
unzipFile = True
verbose = True
daysToDownload = 1
dateToDownload = None
outputFormat = "S_D_%Y_%m_%d.txt.gz"
debug = False

Also on the second bug, here is a run of the program with the custom date and 
without:

With:

MacMini-2:Sales johannes$ ./appdailysales.py -D 10/26/2010
-- begin script --
Signing into iTunes Connect web site.
Accessing Sales and Trends reporting web site.
Accessing sales report web page.
Downloading daily sales reports.
Downloading report for:  10/26/2010
Unzipping archive file:  S_D_2010_10_26.txt.gz
Traceback (most recent call last):
  File "./appdailysales.py", line 476, in <module>
    sys.exit(main())
  File "./appdailysales.py", line 469, in main
    downloadFile(options)
  File "./appdailysales.py", line 417, in downloadFile
    filebuffer = gzipIO.read()
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/gzip.py", line 212, in read
    self._read(readsize)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/gzip.py", line 255, in _read
    self._read_gzip_header()
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/gzip.py", line 156, in _read_gzip_header
    raise IOError, 'Not a gzipped file'
IOError: Not a gzipped file

Without (i.e. outputFormat = None):

MacMini-2:Sales johannes$ ./appdailysales.py -D 10/26/2010
-- begin script --
Signing into iTunes Connect web site.
Accessing Sales and Trends reporting web site.
Accessing sales report web page.
Downloading daily sales reports.
Downloading report for:  10/26/2010
10/26/2010 report is not available - try again later.
1 report(s) not available - try again later

Original comment by jonathan...@gmail.com on 2 Nov 2010 at 8:42

GoogleCodeExporter commented 8 years ago
Thanks Jonathan.  I'll looking to the problems this evening or tomorrow 
(Wednesday) morning at the latest.

Original comment by kirbyt.w...@gmail.com on 2 Nov 2010 at 9:23

GoogleCodeExporter commented 8 years ago
Hi Jonathan,

Thanks for reporting these bugs.

The first, random, bug happens when the vendor default page does not properly 
load. My guess to the cause of the problem is something server side. I modified 
the script to make up to 3 attempts at redirecting to the vendor default page 
before reporting an error. This should eliminate the error as it's been my 
experience that the page redirects always works on the second attempt.

The second bug you reported is a good catch.  It's possible for the response 
from the server to contain HTML and not the actual daily sales report. In the 
scenario you gave, the check for the content-disposition was not performed. 
This led the script to believe a file was downloaded even when there is no 
file. Hence the unzip failure.

Thanks for reporting these. Both issues are fixed in version 2.7 of the script.

-KIRBY

Original comment by kirbyt.w...@gmail.com on 3 Nov 2010 at 12:28

GoogleCodeExporter commented 8 years ago
There is no explaination about how it is fixed.

Original comment by rakeshku...@gmail.com on 29 Aug 2012 at 10:20